From 063940f2d384a70bbf0499865ca0e54e99b96f23 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Apr 2009 19:35:53 +0000 Subject: resume/suspend --- ev.pod | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ev.pod') diff --git a/ev.pod b/ev.pod index 7061527..467ac14 100644 --- a/ev.pod +++ b/ev.pod @@ -636,6 +636,32 @@ the current time is a good idea. See also "The special problem of time updates" in the C section. +=item ev_suspend (loop) + +=item ev_resume (loop) + +These two functions suspend and resume a loop, for use when the loop is +not used for a while and timeouts should not be processed. + +A typical use case would be an interactive program such as a game: When +the user presses C<^Z> to suspend the game and resumes it an hour later it +would be best to handle timeouts as if no time had actually passed while +the program was suspended. This can be achieved by calling C +in your C handler, sending yourself a C and calling +C directly afterwards to resume timer processing. + +Effectively, all C watchers will be delayed by the time spend +between C and C, and all C watchers +will be rescheduled (that is, they will lose any events that would have +occured while suspended). + +After calling C you B call I function on the +given loop other than C, and you B call C +without a previous call to C. + +Calling C/C has the side effect of updating the +event loop time (see C). + =item ev_loop (loop, int flags) Finally, this is it, the event handler. This function usually is called -- cgit v1.2.3