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