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