A cron watcher with start time zero, documented to mean 'now', never
runs:
uev_cron_init(ctx, w, cb, NULL, 0, 3600);
Zero is passed as is to the timerfd, where it disarms the timer.
Replace it with the current time when the event loop is running. This
also goes for uev_cron_set(), where zero no longer disarms the watcher,
use uev_cron_stop() for that.
The event loop used a start time of zero to mark an at job as done.
Stop the watcher there instead and keep its time, so restarting an at
job that was interrupted by a clock change does not run it at once.
Closes#30
uev_run() with only UEV_NONBLOCK never returns when there are watchers
but no events, it spins at full CPU load:
uev_run(ctx, UEV_NONBLOCK);
The loop polls epoll with a zero timeout and only stops on UEV_ONCE.
Leave the loop when a nonblocking poll finds no events.
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
If uev_init1() is called with maxevents > 10 the call to epoll_wait()
might cause buffer overflow. Reported by Steve Palmer.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Apparently libtool is an implicit dependency and does not have to be
listed explicitly.
Add doxygen since we now have full doxygen docs to build.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch fixes the lintian warning package-name-doesnt-match-sonames,
which is a reminder to step the library version to match the soname.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The change in the uev_t means the stack space required, and used by
libuEv, is incompatible with previous releases. So applications
need to be rebuild against the new header file.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>