… | |
… | |
245 | |
245 | |
246 | package AnyEvent; |
246 | package AnyEvent; |
247 | |
247 | |
248 | no warnings; |
248 | no warnings; |
249 | use strict; |
249 | use strict; |
|
|
250 | |
250 | use Carp; |
251 | use Carp; |
251 | |
252 | |
252 | our $VERSION = '2.51'; |
253 | our $VERSION = '2.52'; |
253 | our $MODEL; |
254 | our $MODEL; |
254 | |
255 | |
255 | our $AUTOLOAD; |
256 | our $AUTOLOAD; |
256 | our @ISA; |
257 | our @ISA; |
257 | |
258 | |
… | |
… | |
386 | or Carp::croak "required option 'pid' is missing"; |
387 | or Carp::croak "required option 'pid' is missing"; |
387 | |
388 | |
388 | $PID_CB{$pid}{$arg{cb}} = $arg{cb}; |
389 | $PID_CB{$pid}{$arg{cb}} = $arg{cb}; |
389 | |
390 | |
390 | unless ($WNOHANG) { |
391 | unless ($WNOHANG) { |
391 | $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_child_wait); |
|
|
392 | $WNOHANG = eval { require POSIX; &POSIX::WNOHANG } || 1; |
392 | $WNOHANG = eval { require POSIX; &POSIX::WNOHANG } || 1; |
393 | } |
393 | } |
394 | |
394 | |
|
|
395 | unless ($CHLD_W) { |
|
|
396 | $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_child_wait); |
395 | # child could be a zombie already |
397 | # child could be a zombie already |
396 | $PID_IDLE ||= AnyEvent->timer (after => 0, cb => \&_child_wait); |
398 | $PID_IDLE ||= AnyEvent->timer (after => 0, cb => \&_child_wait); |
|
|
399 | } |
397 | |
400 | |
398 | bless [$pid, $arg{cb}], "AnyEvent::Base::Child" |
401 | bless [$pid, $arg{cb}], "AnyEvent::Base::Child" |
399 | } |
402 | } |
400 | |
403 | |
401 | sub AnyEvent::Base::Child::DESTROY { |
404 | sub AnyEvent::Base::Child::DESTROY { |
… | |
… | |
437 | I<rxvt-unicode> distribution. |
440 | I<rxvt-unicode> distribution. |
438 | |
441 | |
439 | I<rxvt-unicode> also cheats a bit by not providing blocking access to |
442 | I<rxvt-unicode> also cheats a bit by not providing blocking access to |
440 | condition variables: code blocking while waiting for a condition will |
443 | condition variables: code blocking while waiting for a condition will |
441 | C<die>. This still works with most modules/usages, and blocking calls must |
444 | C<die>. This still works with most modules/usages, and blocking calls must |
442 | not be in an interactive appliation, so it makes sense. |
445 | not be in an interactive application, so it makes sense. |
443 | |
446 | |
444 | =head1 ENVIRONMENT VARIABLES |
447 | =head1 ENVIRONMENT VARIABLES |
445 | |
448 | |
446 | The following environment variables are used by this module: |
449 | The following environment variables are used by this module: |
447 | |
450 | |