… | |
… | |
19 | print "ok 2\n"; |
19 | print "ok 2\n"; |
20 | exit 3; |
20 | exit 3; |
21 | } |
21 | } |
22 | |
22 | |
23 | my $w = AnyEvent->child (pid => $pid, cb => sub { |
23 | my $w = AnyEvent->child (pid => $pid, cb => sub { |
24 | print $pid == $_[0] ? "" : "not ", "ok 3\n"; |
24 | print $pid == $_[0] ? "" : "not ", "ok 3\ # $pid == $_[0]\n"; |
25 | print 3 == ($_[1] >> 8) ? "" : "not ", "ok 4\n"; |
25 | print 3 == ($_[1] >> 8) ? "" : "not ", "ok 4 # 3 == $_[1] >> 8 ($_[1])\n"; |
26 | $cv->broadcast; |
26 | $cv->broadcast; |
27 | }); |
27 | }); |
28 | |
28 | |
29 | $cv->wait; |
29 | $cv->wait; |
30 | |
30 | |
31 | my $pid2 = fork || exit 7; |
31 | my $pid2 = fork || exit 7; |
32 | |
32 | |
33 | my $cv2 = AnyEvent->condvar; |
33 | my $cv2 = AnyEvent->condvar; |
34 | |
34 | |
35 | my $w2 = AnyEvent->child (pid => 0, cb => sub { |
35 | my $w2 = AnyEvent->child (pid => 0, cb => sub { |
36 | print $pid2 == $_[0] ? "" : "not ", "ok 5\n"; |
36 | print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; |
37 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6\n"; |
37 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; |
38 | $cv2->broadcast; |
38 | $cv2->broadcast; |
39 | }); |
39 | }); |
40 | |
40 | |
41 | $cv2->wait; |
41 | $cv2->wait; |
42 | |
42 | |