ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/03_child.t
(Generate patch)

Comparing AnyEvent/t/03_child.t (file contents):
Revision 1.1 by root, Mon Dec 11 01:16:09 2006 UTC vs.
Revision 1.5 by root, Fri Nov 16 05:08:18 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines