… | |
… | |
44 | |
44 | |
45 | # POE hits a race condition when the child dies too quickly |
45 | # POE hits a race condition when the child dies too quickly |
46 | # because it checks for child exit before installing the signal handler. |
46 | # because it checks for child exit before installing the signal handler. |
47 | # seen in version 1.352 - earlier versions had the same bug, but |
47 | # seen in version 1.352 - earlier versions had the same bug, but |
48 | # polled for child exits regularly, so only caused a delay. |
48 | # polled for child exits regularly, so only caused a delay. |
49 | sleep 1 if $AnyEvent::MODEL eq "POE"; |
49 | sleep 1 if $AnyEvent::MODEL eq "AnyEvent::Impl::POE"; |
50 | |
50 | |
51 | POSIX::_exit 3; |
51 | POSIX::_exit 3; |
52 | } |
52 | } |
53 | my $w = AnyEvent->child (pid => $pid, cb => sub { |
53 | my $w = AnyEvent->child (pid => $pid, cb => sub { |
54 | print $pid == $_[0] ? "" : "not ", "ok ${it}3\ # $pid == $_[0]\n"; |
54 | print $pid == $_[0] ? "" : "not ", "ok ${it}3\ # $pid == $_[0]\n"; |
… | |
… | |
56 | $cv->broadcast; |
56 | $cv->broadcast; |
57 | }); |
57 | }); |
58 | |
58 | |
59 | $cv->recv; |
59 | $cv->recv; |
60 | |
60 | |
61 | my $pid2 = fork || POSIX::_exit 7; |
61 | my $pid2 = fork || do { |
|
|
62 | sleep 1 if $AnyEvent::MODEL eq "AnyEvent::Impl::POE"; |
|
|
63 | POSIX::_exit 7; |
|
|
64 | }; |
62 | |
65 | |
63 | my $cv2 = AnyEvent->condvar; |
66 | my $cv2 = AnyEvent->condvar; |
64 | |
67 | |
65 | # Glib is the only model that doesn't support pid == 0 |
68 | # Glib is the only model that doesn't support pid == 0 |
66 | my $pid0 = $AnyEvent::MODEL eq "AnyEvent::Impl::Glib" ? $pid2 : 0; |
69 | my $pid0 = $AnyEvent::MODEL eq "AnyEvent::Impl::Glib" ? $pid2 : 0; |