… | |
… | |
32 | |
32 | |
33 | my $pid = fork; |
33 | my $pid = fork; |
34 | |
34 | |
35 | defined $pid or die "unable to fork"; |
35 | defined $pid or die "unable to fork"; |
36 | |
36 | |
37 | # work around Tk bug until it has been fixed. |
37 | # work around Tk bug until it has been fixed. |
38 | #my $timer = AnyEvent->timer (after => 2, cb => sub { }); |
38 | #my $timer = AnyEvent->timer (after => 2, cb => sub { }); |
39 | |
39 | |
40 | my $cv = AnyEvent->condvar; |
40 | my $cv = AnyEvent->condvar; |
41 | |
41 | |
42 | unless ($pid) { |
42 | unless ($pid) { |
43 | print "ok ${it}2\n"; |
43 | print "ok ${it}2\n"; |
… | |
… | |
54 | |
54 | |
55 | my $pid2 = fork || POSIX::_exit 7; |
55 | my $pid2 = fork || POSIX::_exit 7; |
56 | |
56 | |
57 | my $cv2 = AnyEvent->condvar; |
57 | my $cv2 = AnyEvent->condvar; |
58 | |
58 | |
|
|
59 | # Glib is the only model that doesn't support pid == 0 |
|
|
60 | my $pid0 = $AnyEvent::MODEL eq "AnyEvent::Impl::Glib" ? $pid2 : 0; |
|
|
61 | |
59 | my $w2 = AnyEvent->child (pid => 0, cb => sub { |
62 | my $w2 = AnyEvent->child (pid => $pid0, cb => sub { |
60 | print $pid2 == $_[0] ? "" : "not ", "ok ${it}5 # $pid2 == $_[0]\n"; |
63 | print $pid2 == $_[0] ? "" : "not ", "ok ${it}5 # $pid2 == $_[0]\n"; |
61 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok ${it}6 # 7 == $_[1] >> 8 ($_[1])\n"; |
64 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok ${it}6 # 7 == $_[1] >> 8 ($_[1])\n"; |
62 | $cv2->broadcast; |
65 | $cv2->broadcast; |
63 | }); |
66 | }); |
64 | |
67 | |