From: root Date: Sat, 17 Nov 2007 02:00:48 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: rel-1_2~11 X-Git-Url: https://git.llucax.com/software/libev.git/commitdiff_plain/b05a0efa267648cf18cad1e018068034b735093b?hp=bdc7d079474f709e195c868021926b3c0c7d94a2 *** empty log message *** --- diff --git a/ev.c b/ev.c index b47e20c..9e172b7 100644 --- a/ev.c +++ b/ev.c @@ -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); diff --git a/ev.pod b/ev.pod index f9b6a83..411fbb5 100644 --- a/ev.pod +++ b/ev.pod @@ -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 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 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) 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)