Keep timer deadlines between calls to uev_run()

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
This commit is contained in:
omrzk authored and Joachim Wiberg committed 2026-11-16 15:08:41 +01:00
1 parent 354cdcaf7a
commit 09d9b6ba04
6 files changed
+53 -10

No files matched your search

+3
View File
@@ -171,6 +171,9 @@ With `flags` set to `UEV_ONCE` the event loop returns as soon as it has
served the first event. If `flags` is set to `UEV_ONCE | UEV_NONBLOCK`
the event loop returns immediately if no event is available.
Timers are started by the first call to `uev_run()` and keep their
deadline between calls. Use `uev_timer_set()` to restart a timer.
```
if (result < 0)
errx(result, "Unrecoverable event loop error, error %d", result);