--- EV/EV.pm 2007/10/27 07:30:10 1.6 +++ EV/EV.pm 2007/10/27 14:54:20 1.7 @@ -103,13 +103,21 @@ when the events specified in C<$eventmask> happen. Initially, the timeout is disabled. -The C variant doesn't add/start the newly created watcher. +Youc an additionall set a timeout to occur on the watcher, but note that +this timeout will not be reset when you get an I/O event in the EV::PERSIST +case, and reaching a timeout will always stop the watcher even in the +EV::PERSIST case. + +If you want a timeout to occur only after a specific time of inactivity, set +a repeating timeout and do NOT use EV::PERSIST. Eventmask can be one or more of these constants ORed together: EV::READ wait until read() wouldn't block anymore EV::WRITE wait until write() wouldn't block anymore - EV::PERSIST stay active after an event occured + EV::PERSIST stay active after a (non-timeout) event occured + +The C variant doesn't add/start the newly created watcher. =item my $w = EV::timer $after, $repeat, $callback @@ -140,6 +148,10 @@ as long as the processing time is less then the interval (otherwise obviously events will be skipped). +Another way to think about it (for the mathematically inclined) is that +C will try to tun the callback at the next possible time where +C<$time = $at (mod $interval)>, regardless of any time jumps. + The C variant doesn't add/start the newly created watcher. =item my $w = EV::signal $signum, $callback @@ -211,25 +223,18 @@ Lots. Libevent itself isn't well tested and rather buggy, and this module is quite new at the moment. -Please note that the epoll method is not, in general, reliable in -programs that use fork (even if no libveent calls are being made in the -forked process). Since this is such a common issue, this module will -force the epoll method in EV to be off *unless* the global variable -$EV::ENABLE_EPOLL is set to 1 *before* loading this module for the first -time. +Please note that the epoll method is not, in general, reliable in programs +that use fork (even if no libveent calls are being made in the forked +process). If your program behaves erratically, try setting the environment +variable C first when running the program. + +In general, if you fork, then you can only use the EV module in one of the +children. =cut our $NPRI = 4; -our $BASE; -our $ENABLE_EPOLL; - -{ - local $ENV{EVENT_NOEPOLL}; - $ENV{EVENT_NOEPOLL} = 1 unless $ENABLE_EPOLL; - $BASE = init; -} - +our $BASE = init; priority_init $NPRI; push @AnyEvent::REGISTRY, [EV => "EV::AnyEvent"];