--- AnyEvent/lib/AnyEvent.pm 2007/11/02 19:20:36 1.31 +++ AnyEvent/lib/AnyEvent.pm 2007/11/16 09:13:11 1.36 @@ -72,7 +72,7 @@ C the Perl I (not filedescriptor) to watch for events. C must be a string that is either C or C, that creates -a watcher waiting for "r"eadable or "w"ritable events. C teh callback +a watcher waiting for "r"eadable or "w"ritable events. C the callback to invoke everytime the filehandle becomes ready. Only one io watcher per C and C combination is allowed (i.e. on @@ -178,7 +178,8 @@ You can also listen for the status of a child process specified by the 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. +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 @@ -198,7 +199,8 @@ The known classes so far are: - EV::AnyEvent based on EV (an interface to libev, 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. @@ -252,7 +254,7 @@ use Carp; -our $VERSION = '2.55'; +our $VERSION = '2.6'; our $MODEL; our $AUTOLOAD; @@ -263,8 +265,9 @@ our @REGISTRY; my @models = ( + [Coro::EV:: => AnyEvent::Impl::CoroEV::], + [EV:: => AnyEvent::Impl::EV::], [Coro::Event:: => AnyEvent::Impl::Coro::], - [EV:: => EV::AnyEvent::], [Event:: => AnyEvent::Impl::Event::], [Glib:: => AnyEvent::Impl::Glib::], [Tk:: => AnyEvent::Impl::Tk::], @@ -304,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; @@ -376,9 +379,9 @@ our $WNOHANG; sub _child_wait { - while (0 < (my $pid = waitpid -1, $WNOHANG)) { - $_->() for (values %{ $PID_CB{$pid} || {} }), - (values %{ $PID_CB{0} || {} }); + while (0 <= (my $pid = waitpid -1, $WNOHANG)) { + $_->($pid, $?) for (values %{ $PID_CB{$pid} || {} }), + (values %{ $PID_CB{0} || {} }); } undef $PID_IDLE;