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