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.4 by root, Fri Nov 9 19:34:32 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines