Timers never expire when the event loop is run one iteration at a time
and something else keeps it busy, e.g., when polled from another event
loop:
uev_run(ctx, UEV_ONCE | UEV_NONBLOCK);
Every call to uev_run() starts all timers over from their full timeout.
Start dormant timers on the first call only. A caller that wants a
timer restarted for each call must now use uev_timer_set().
Closes#36
uev_init() leaves the context descriptor at 0 when epoll_create1()
fails. A following uev_exit() then closes stdin.
Set it to -1 before creating the epoll descriptor.
uev_event_init() leaks its eventfd, and leaves it in the watcher, when
the watcher cannot be added to the event loop.
Close it and reset the descriptor in the watcher.
uev_cron_start() on a stopped cron watcher brings it back as a regular
timer, with a timeout made up of parts of the cron schedule. It calls
uev_timer_start(), which reads the timer fields of the watcher and
creates a monotonic timer.
Restart with uev_cron_set() and the cron schedule instead.
With stdin redirected from a regular file, uev_run() with UEV_ONCE does
not return until end of file:
app < file.txt
The workaround for regular files, which epoll cannot watch, restarts
the loop before the UEV_ONCE check.
Check the flag there too.
Closes#37
uev_io_set() on an active oneshot watcher keeps watching the old
descriptor, for the old events:
uev_io_set(w, newfd, UEV_READ | UEV_ONESHOT);
It only rearms the watcher, with what is already stored in it.
Rearm only when neither has changed, otherwise stop the watcher and set
it up again.
Closes#35