--- AnyEvent/lib/AnyEvent.pm 2006/12/31 11:54:43 1.22 +++ AnyEvent/lib/AnyEvent.pm 2007/03/07 17:37:24 1.23 @@ -249,7 +249,7 @@ use strict; use Carp; -our $VERSION = '2.51'; +our $VERSION = '2.52'; our $MODEL; our $AUTOLOAD; @@ -388,12 +388,14 @@ $PID_CB{$pid}{$arg{cb}} = $arg{cb}; unless ($WNOHANG) { - $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_child_wait); $WNOHANG = eval { require POSIX; &POSIX::WNOHANG } || 1; } - # child could be a zombie already - $PID_IDLE ||= AnyEvent->timer (after => 0, cb => \&_child_wait); + unless ($CHLD_W) { + $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_child_wait); + # child could be a zombie already + $PID_IDLE ||= AnyEvent->timer (after => 0, cb => \&_child_wait); + } bless [$pid, $arg{cb}], "AnyEvent::Base::Child" }