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

Comparing AnyEvent/t/68_poe_09_multi.t (file contents):
Revision 1.1 by root, Tue Aug 2 22:07:18 2011 UTC vs.
Revision 1.3 by root, Fri Aug 12 00:53:29 2011 UTC

1BEGIN {
2 # check for broken perls
3 if ($^O =~ /mswin32/i) {
4 my $ok;
5 local $SIG{CHLD} = sub { $ok = 1 };
6 kill 'CHLD', 0;
7
8 unless ($ok) {
9 print <<EOF;
101..0 # SKIP Your perl interpreter is badly BROKEN. Child watchers will not work, ever. Try upgrading to a newer perl or a working perl (cygwin's perl is known to work). If that is not an option, you should be able to use the remaining functionality of AnyEvent, but child watchers WILL NOT WORK.
11EOF
12 exit 0;
13 }
14 }
15}
16
1use AnyEvent; 17use AnyEvent;
2use AnyEvent::Util; 18use AnyEvent::Util;
3BEGIN { eval q{use AnyEvent::Impl::POE;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::POE not loadable 19BEGIN { eval q{use AnyEvent::Impl::POE;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::POE not loadable
4}), exit 0) } $^W = 0; 20}), exit 0) } $^W = 0;
5 21
6$| = 1; print "1..14\n"; 22$| = 1; print "1..15\n";
7 23
8print "ok 1\n"; 24print "ok 1\n";
9 25
10my ($a, $b) = AnyEvent::Util::portable_socketpair; 26my ($a, $b) = AnyEvent::Util::portable_socketpair;
11 27
12# I/O write 28# I/O write
13{ 29{
14 my $cv = AE::cv; 30 my $cv = AE::cv;
15 my $wt = AE::timer 0.1, 0, $cv; 31 my $wt = AE::timer 1, 0, $cv;
16 my $s = 0; 32 my $s = 0;
17 33
18 $cv->begin; my $wa = AE::io $a, 1, sub { $cv->end; $s |= 1 }; 34 $cv->begin; my $wa = AE::io $a, 1, sub { $cv->end; $s |= 1 };
19 $cv->begin; my $wb = AE::io $a, 1, sub { $cv->end; $s |= 2 }; 35 $cv->begin; my $wb = AE::io $a, 1, sub { $cv->end; $s |= 2 };
20 36
37 print $s == 0 ? "" : "not ", "ok 3 # $s\n"; 53 print $s == 0 ? "" : "not ", "ok 3 # $s\n";
38 54
39 syswrite $b, "x"; 55 syswrite $b, "x";
40 56
41 $cv = AE::cv; 57 $cv = AE::cv;
42 $wt = AE::timer 0.1, 0, $cv; 58 $wt = AE::timer 1, 0, $cv;
43 59
44 $s = 0; 60 $s = 0;
45 $cv->begin; 61 $cv->begin;
46 $cv->begin; 62 $cv->begin;
47 $cv->recv; 63 $cv->recv;
134 $cv->recv; 150 $cv->recv;
135 151
136 print $s == 0 ? "" : "not ", "ok 13 # $s\n"; 152 print $s == 0 ? "" : "not ", "ok 13 # $s\n";
137} 153}
138 154
155# timers (don't laugh, some event loops are more broken...)
156{
157 my $cv = AE::cv;
158 my $wt = AE::timer 1, 0, $cv;
159 my $s = 0;
160
161 $cv->begin; my $wa = AE::timer 0 , 0, sub { $cv->end; $s |= 1 };
162 $cv->begin; my $wb = AE::timer 0 , 0, sub { $cv->end; $s |= 2 };
163 $cv->begin; my $wc = AE::timer 0.01, 0, sub { $cv->end; $s |= 4 };
164
165 $cv->recv;
166
167 print $s == 7 ? "" : "not ", "ok 14 # $s\n";
168}
169
139print "ok 14\n"; 170print "ok 15\n";
140 171
141exit 0; 172exit 0;
142 173

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines