summaryrefslogtreecommitdiff
path: root/ev.pod
diff options
context:
space:
mode:
Diffstat (limited to 'ev.pod')
-rw-r--r--ev.pod28
1 files changed, 15 insertions, 13 deletions
diff --git a/ev.pod b/ev.pod
index aaf225d..1e0234c 100644
--- a/ev.pod
+++ b/ev.pod
@@ -918,23 +918,25 @@ timer will not fire more than once per event loop iteration.
This will act as if the timer timed out and restart it again if it is
repeating. The exact semantics are:
-If the timer is started but nonrepeating, stop it.
+If the timer is pending, its pending status is cleared.
-If the timer is repeating, either start it if necessary (with the repeat
-value), or reset the running timer to the repeat value.
+If the timer is started but nonrepeating, stop it (as if it timed out).
+
+If the timer is repeating, either start it if necessary (with the
+C<repeat> value), or reset the running timer to the C<repeat> value.
This sounds a bit complicated, but here is a useful and typical
-example: Imagine you have a tcp connection and you want a so-called
-idle timeout, that is, you want to be called when there have been,
-say, 60 seconds of inactivity on the socket. The easiest way to do
-this is to configure an C<ev_timer> with C<after>=C<repeat>=C<60> and calling
+example: Imagine you have a tcp connection and you want a so-called idle
+timeout, that is, you want to be called when there have been, say, 60
+seconds of inactivity on the socket. The easiest way to do this is to
+configure an C<ev_timer> with a C<repeat> value of C<60> and then call
C<ev_timer_again> each time you successfully read or write some data. If
you go into an idle state where you do not expect data to travel on the
-socket, you can stop the timer, and again will automatically restart it if
-need be.
+socket, you can C<ev_timer_stop> the timer, and C<ev_timer_again> will
+automatically restart it if need be.
-You can also ignore the C<after> value and C<ev_timer_start> altogether
-and only ever use the C<repeat> value:
+That means you can ignore the C<after> value and C<ev_timer_start>
+altogether and only ever use the C<repeat> value and C<ev_timer_again>:
ev_timer_init (timer, callback, 0., 5.);
ev_timer_again (loop, timer);
@@ -945,8 +947,8 @@ and only ever use the C<repeat> value:
timer->again = 10.;
ev_timer_again (loop, timer);
-This is more efficient then stopping/starting the timer eahc time you want
-to modify its timeout value.
+This is more slightly efficient then stopping/starting the timer each time
+you want to modify its timeout value.
=item ev_tstamp repeat [read-write]