ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/03_child.t
Revision: 1.1
Committed: Mon Dec 11 01:16:09 2006 UTC (17 years, 6 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-2_5, rel-2_51, rel-2_52
Log Message:
*** empty log message ***

File Contents

# Content
1 $|=1;
2 BEGIN { print "1..4\n" }
3
4 use AnyEvent;
5
6 print "ok 1\n";
7
8 my $pid = fork;
9
10 defined $pid or die "unable to fork";
11
12 # work around Tk bug until it has been fixed.
13 my $timer = AnyEvent->timer (after => 2, cb => sub { });
14
15 my $cv = AnyEvent->condvar;
16
17 unless ($pid) {
18 print "ok 2\n";
19 exit 3;
20 }
21
22 my $w = AnyEvent->child (pid => $pid, cb => sub {
23 print 3 == ($? >> 8) ? "" : "not ", "ok 3\n";
24 $cv->broadcast;
25 });
26
27 $cv->wait;
28
29 print "ok 4\n";
30
31
32
33