--- cvsroot/EV/EV.pm 2009/02/15 01:44:40 1.112 +++ cvsroot/EV/EV.pm 2009/07/14 00:09:59 1.117 @@ -78,11 +78,10 @@ package EV; -no warnings; -use strict; +use common::sense; BEGIN { - our $VERSION = '3.53'; + our $VERSION = '3.6'; use XSLoader; XSLoader::load "EV", $VERSION; } @@ -127,7 +126,7 @@ =over 4 -=item $loop = new EV::loop [$flags] +=item $loop = new EV::Loop [$flags] Create a new event loop as per the specified flags. Please refer to the C function description in the libev documentation @@ -204,6 +203,48 @@ is the time that (relative) timers are based on, and referring to it is usually faster then calling EV::time. +=item EV::now_update + +=item $loop->now_update + +Establishes the current time by querying the kernel, updating the time +returned by C in the progress. This is a costly operation and +is usually done automatically within C. + +This function is rarely useful, but when some event callback runs for a +very long time without entering the event loop, updating libev's idea of +the current time is a good idea. + +=item EV::suspend + +=item $loop->suspend + +=item EV::resume + +=item $loop->resume + +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 $backend = EV::backend =item $backend = $loop->backend @@ -1004,9 +1045,9 @@ =head3 ASYNC WATCHERS - how to wake up another event loop -Async watchers are provided by EV, but have little use in perl directly, as perl -neither supports threads nor direct access to signal handlers or other -contexts where they could be of value. +Async watchers are provided by EV, but have little use in perl directly, +as perl neither supports threads running in parallel nor direct access to +signal handlers or other contexts where they could be of value. It is, however, possible to use them from the XS level. @@ -1044,11 +1085,11 @@ This ensures that perl gets into control for a short time to handle any pending signals, and also ensures (slightly) slower overall operation. -=head1 THREADS +=head1 ITHREADS -Threads are not supported by this module in any way. Perl pseudo-threads -is evil stuff and must die. As soon as Perl gains real threads I will work -on thread support for it. +Ithreads are not supported by this module in any way. Perl pseudo-threads +is evil stuff and must die. Real threads as provided by Coro are fully +supported (and enhanced support is available via L). =head1 FORK