From 5466167e0504f6fd929074dda89e770d4abfd3c3 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 9 Dec 2007 19:42:57 +0000 Subject: *** empty log message *** --- ev.html | 30 ++++++++++++++++++++---------- ev.pod | 30 +++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/ev.html b/ev.html index da28682..308d179 100644 --- a/ev.html +++ b/ev.html @@ -6,7 +6,7 @@ - + @@ -1099,10 +1099,10 @@ to trigger "at" some specific point in time. For example, if you tell periodic watcher to trigger in 10 seconds (by specifiying e.g. ev_now () + 10.) and then reset your system clock to the last year, then it will take a year to trigger the event (unlike an ev_timer, which would trigger -roughly 10 seconds later and of course not if you reset your system time -again).

+roughly 10 seconds later).

They can also be used to implement vastly more complex timers, such as -triggering an event on eahc midnight, local time.

+triggering an event on each midnight, local time or other, complicated, +rules.

As with timers, the callback is guarenteed to be invoked only when the time (at) has been passed, but if multiple periodic timers become ready during the same loop iteration then order of execution is undefined.

@@ -1114,18 +1114,18 @@ during the same loop iteration then order of execution is undefined.

operation, and we will explain them from simplest to complex:

-
* absolute timer (interval = reschedule_cb = 0)
+
* absolute timer (at = time, interval = reschedule_cb = 0)

In this configuration the watcher triggers an event at the wallclock time at and doesn't repeat. It will not adjust when a time jump occurs, that is, if it is to be run at January 1st 2011 then it will run when the system time reaches or surpasses this time.

-
* non-repeating interval timer (interval > 0, reschedule_cb = 0)
+
* non-repeating interval timer (at = offset, interval > 0, reschedule_cb = 0)

In this mode the watcher will always be scheduled to time out at the next -at + N * interval time (for some integer N) and then repeat, regardless -of any time jumps.

+at + N * interval time (for some integer N, which can also be negative) +and then repeat, regardless of any time jumps.

This can be used to create timers that do not drift with respect to system time:

   ev_periodic_set (&periodic, 0., 3600., 0);
@@ -1138,8 +1138,11 @@ by 3600.

Another way to think about it (for the mathematically inclined) is that ev_periodic will try to run the callback in this mode at the next possible time where time = at (mod interval), regardless of any time jumps.

+

For numerical stability it is preferable that the at value is near +ev_now () (the current time), but there is no range requirement for +this value.

-
* manual reschedule mode (reschedule_cb = callback)
+
* manual reschedule mode (at and interval ignored, reschedule_cb = callback)

In this mode the values for interval and at are both being ignored. Instead, each time the periodic watcher gets scheduled, the @@ -1148,7 +1151,7 @@ current time as second argument.

NOTE: This callback MUST NOT stop or destroy any periodic watcher, ever, or make any event loop modifications. If you need to stop it, return now + 1e30 (or so, fudge fudge) and stop it afterwards (e.g. by -starting a prepare watcher).

+starting an ev_prepare watcher, which is legal).

Its prototype is ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now), e.g.:

   static ev_tstamp my_rescheduler (struct ev_periodic *w, ev_tstamp now)
@@ -1178,6 +1181,13 @@ reason I omitted it as an example).

when you changed some parameters or the reschedule callback would return a different time than the last time it was called (e.g. in a crond like program when the crontabs have changed).

+
+
ev_tstamp offset [read-write]
+
+

When repeating, this contains the offset value, otherwise this is the +absolute point in time (the at value passed to ev_periodic_set).

+

Can be modified any time, but changes only take effect when the periodic +timer fires or ev_periodic_again is being called.

ev_tstamp interval [read-write]
diff --git a/ev.pod b/ev.pod index 237bdb0..3ad52c0 100644 --- a/ev.pod +++ b/ev.pod @@ -1076,11 +1076,11 @@ to trigger "at" some specific point in time. For example, if you tell a periodic watcher to trigger in 10 seconds (by specifiying e.g. C) and then reset your system clock to the last year, then it will take a year to trigger the event (unlike an C, which would trigger -roughly 10 seconds later and of course not if you reset your system time -again). +roughly 10 seconds later). They can also be used to implement vastly more complex timers, such as -triggering an event on eahc midnight, local time. +triggering an event on each midnight, local time or other, complicated, +rules. 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 @@ -1097,18 +1097,18 @@ operation, and we will explain them from simplest to complex: =over 4 -=item * absolute timer (interval = reschedule_cb = 0) +=item * absolute timer (at = time, interval = reschedule_cb = 0) In this configuration the watcher triggers an event at the wallclock time C and doesn't repeat. It will not adjust when a time jump occurs, that is, if it is to be run at January 1st 2011 then it will run when the system time reaches or surpasses this time. -=item * non-repeating interval timer (interval > 0, reschedule_cb = 0) +=item * non-repeating interval timer (at = offset, interval > 0, reschedule_cb = 0) In this mode the watcher will always be scheduled to time out at the next -C time (for some integer N) and then repeat, regardless -of any time jumps. +C time (for some integer N, which can also be negative) +and then repeat, regardless of any time jumps. This can be used to create timers that do not drift with respect to system time: @@ -1124,7 +1124,11 @@ Another way to think about it (for the mathematically inclined) is that C will try to run the callback in this mode at the next possible time where C