--- AnyEvent/lib/AnyEvent.pm 2007/07/08 08:52:10 1.26 +++ AnyEvent/lib/AnyEvent.pm 2007/11/14 23:24:16 1.35 @@ -176,8 +176,10 @@ =head2 CHILD PROCESS WATCHERS You can also listen for the status of a child process specified by the -C argument. The watcher will only trigger once. This works by -installing a signal handler for C. +C argument (or any child if the pid argument is 0). The watcher will +trigger as often as status change for the child are received. This works +by installing a signal handler for C. The callback will be called with +the pid and exit status (as returned by waitpid). Example: wait for pid 1333 @@ -197,8 +199,10 @@ The known classes so far are: - AnyEvent::Impl::Coro based on Coro::Event, best choise. - AnyEvent::Impl::Event based on Event, also best choice :) + AnyEvent::Impl::CoroEV based on Coro::EV, best choice. + AnyEvent::Impl::EV based on EV (an interface to libev, also best choice). + AnyEvent::Impl::Coro based on Coro::Event, second best choice. + AnyEvent::Impl::Event based on Event, also second best choice :) AnyEvent::Impl::Glib based on Glib, second-best choice. AnyEvent::Impl::Tk based on Tk, very bad choice. AnyEvent::Impl::Perl pure-perl implementation, inefficient. @@ -250,7 +254,7 @@ use Carp; -our $VERSION = '2.53'; +our $VERSION = '2.6'; our $MODEL; our $AUTOLOAD; @@ -261,6 +265,8 @@ our @REGISTRY; my @models = ( + [Coro::EV:: => AnyEvent::Impl::CoroEV::], + [EV:: => AnyEvent::Impl::EV::], [Coro::Event:: => AnyEvent::Impl::Coro::], [Event:: => AnyEvent::Impl::Event::], [Glib:: => AnyEvent::Impl::Glib::], @@ -301,7 +307,7 @@ } $MODEL - or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: Event (or Coro+Event), Glib or Tk."; + or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV (or Coro+EV), Event (or Coro+Event), Glib or Tk."; } unshift @ISA, $MODEL; @@ -373,8 +379,9 @@ our $WNOHANG; sub _child_wait { - while (0 < (my $pid = waitpid -1, $WNOHANG)) { - $_->() for values %{ (delete $PID_CB{$pid}) || {} }; + while (0 <= (my $pid = waitpid -1, $WNOHANG)) { + $_->($pid, $?) for (values %{ $PID_CB{$pid} || {} }), + (values %{ $PID_CB{0} || {} }); } undef $PID_IDLE; @@ -383,7 +390,7 @@ sub child { my (undef, %arg) = @_; - my $pid = uc $arg{pid} + defined (my $pid = $arg{pid} + 0) or Carp::croak "required option 'pid' is missing"; $PID_CB{$pid}{$arg{cb}} = $arg{cb};