diff options
-rw-r--r-- | ev.c | 4 | ||||
-rw-r--r-- | ev.pod | 15 |
2 files changed, 13 insertions, 6 deletions
@@ -996,7 +996,7 @@ any_pending (EV_P) return 0; } -static void +inline void call_pending (EV_P) { int pri; @@ -1006,7 +1006,7 @@ call_pending (EV_P) { ANPENDING *p = pendings [pri] + --pendingcnt [pri]; - if (p->w) + if (expect_true (p->w)) { p->w->pending = 0; EV_CB_INVOKE (p->w, p->events); @@ -474,17 +474,21 @@ given time, and optionally repeating in regular intervals after that. The timers are based on real time, that is, if you register an event that times out after an hour and you reset your system clock to last years time, it will still time out after (roughly) and hour. "Roughly" because -detecting time jumps is hard, and soem inaccuracies are unavoidable (the +detecting time jumps is hard, and some inaccuracies are unavoidable (the monotonic clock option helps a lot here). The relative timeouts are calculated relative to the C<ev_now ()> time. This is usually the right thing as this timestamp refers to the time -of the event triggering whatever timeout you are modifying/starting. If -you suspect event processing to be delayed and you *need* to base the timeout +of the event triggering whatever timeout you are modifying/starting. If +you suspect event processing to be delayed and you I<need> to base the timeout on the current time, use something like this to adjust for this: ev_timer_set (&timer, after + ev_now () - ev_time (), 0.); +The callback is guarenteed to be invoked only when its timeout has passed, +but if multiple timers become ready during the same loop iteration then +order of execution is undefined. + =over 4 =item ev_timer_init (ev_timer *, callback, ev_tstamp after, ev_tstamp repeat) @@ -540,6 +544,10 @@ again). They can also be used to implement vastly more complex timers, such as triggering an event on eahc midnight, local time. +As with timers, the callback is guarenteed to be invoked only when the +time (C<at>) has been passed, but if multiple periodic timers become ready +during the same loop iteration then order of execution is undefined. + =over 4 =item ev_periodic_init (ev_periodic *, callback, ev_tstamp at, ev_tstamp interval, reschedule_cb) @@ -549,7 +557,6 @@ triggering an event on eahc midnight, local time. Lots of arguments, lets sort it out... There are basically three modes of operation, and we will explain them from simplest to complex: - =over 4 =item * absolute timer (interval = reschedule_cb = 0) |