--- cvsroot/EV/EV.pm 2007/10/31 10:53:53 1.14 +++ cvsroot/EV/EV.pm 2007/11/01 11:43:10 1.19 @@ -25,8 +25,8 @@ # IO my $w = EV::io \*STDIN, EV::READ | EV::PERSIST, sub { - my ($w, $events) = @_; # all callbacks get the watcher object and event mask - if ($events & EV::TIMEOUT) { + my ($w, $revents) = @_; # all callbacks get the watcher object and event mask + if ($revents & EV::TIMEOUT) { warn "nothing received on stdin for 10 seconds, retrying"; } else { warn "stdin is readable, you entered: ", ; @@ -35,8 +35,8 @@ $w->timeout (10); my $w = EV::timed_io \*STDIN, EV::READ, 30, sub { - my ($w, $events) = @_; - if ($_[1] & EV::TIMEOUT) { + my ($w, $revents) = @_; + if ($revents & EV::TIMEOUT) { warn "nothing entered within 30 seconds, bye bye.\n"; $w->stop; } else { @@ -54,22 +54,25 @@ my $w = EV::signal 3, sub { warn "sigquit received (this is GNU/Linux, right?)\n"; }; + + # CHILD/PID STATUS CHANGES + + my $w = EV::child 666, sub { + my ($w, $revents, $status) = @_; + }; # MAINLOOP EV::dispatch; # loop as long as watchers are active EV::loop; # the same thing - EV::loop EV::LOOP_ONCE; # block until some events could be handles + EV::loop EV::LOOP_ONESHOT; # block until some events could be handles EV::loop EV::LOOP_NONBLOCK; # check and handle some events, but do not wait =head1 DESCRIPTION -This module provides an interface to libevent -(L). You probably should acquaint -yourself with its documentation and source code to be able to use this -module fully. - -Please note thta this module disables the libevent EPOLL method by -default, see BUGS, below, if you need to enable it. +This module provides an interface to libev +(L). You probably should +acquaint yourself with its documentation and source code to be able to use +this module fully. =cut @@ -78,11 +81,20 @@ use strict; BEGIN { - our $VERSION = '0.03'; + our $VERSION = '0.1'; use XSLoader; XSLoader::load "EV", $VERSION; } +@EV::Io::ISA = +@EV::Timer::ISA = +@EV::Periodic::ISA = +@EV::Signal::ISA = +@EV::Idle::ISA = +@EV::Prepare::ISA = +@EV::Check::ISA = +@EV::Child::ISA = "EV::Watcher"; + =head1 BASIC INTERFACE =over 4 @@ -288,19 +300,6 @@ Threads are not supported by this in any way. Perl pseudo-threads is evil and must die. -=head1 BUGS - -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). 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 $DIED = sub {