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

Comparing AnyEvent/t/66_ioasync_09_multi.t (file contents):
Revision 1.2 by root, Thu Aug 4 09:14:03 2011 UTC vs.
Revision 1.3 by root, Fri Aug 12 00:53:29 2011 UTC

17use AnyEvent; 17use AnyEvent;
18use AnyEvent::Util; 18use AnyEvent::Util;
19BEGIN { eval q{use AnyEvent::Impl::IOAsync;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::IOAsync not loadable 19BEGIN { eval q{use AnyEvent::Impl::IOAsync;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::IOAsync not loadable
20}), exit 0) } 20}), exit 0) }
21 21
22$| = 1; print "1..14\n"; 22$| = 1; print "1..15\n";
23 23
24print "ok 1\n"; 24print "ok 1\n";
25 25
26my ($a, $b) = AnyEvent::Util::portable_socketpair; 26my ($a, $b) = AnyEvent::Util::portable_socketpair;
27 27
28# I/O write 28# I/O write
29{ 29{
30 my $cv = AE::cv; 30 my $cv = AE::cv;
31 my $wt = AE::timer 0.1, 0, $cv; 31 my $wt = AE::timer 1, 0, $cv;
32 my $s = 0; 32 my $s = 0;
33 33
34 $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 };
35 $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 };
36 36
53 print $s == 0 ? "" : "not ", "ok 3 # $s\n"; 53 print $s == 0 ? "" : "not ", "ok 3 # $s\n";
54 54
55 syswrite $b, "x"; 55 syswrite $b, "x";
56 56
57 $cv = AE::cv; 57 $cv = AE::cv;
58 $wt = AE::timer 0.1, 0, $cv; 58 $wt = AE::timer 1, 0, $cv;
59 59
60 $s = 0; 60 $s = 0;
61 $cv->begin; 61 $cv->begin;
62 $cv->begin; 62 $cv->begin;
63 $cv->recv; 63 $cv->recv;
150 $cv->recv; 150 $cv->recv;
151 151
152 print $s == 0 ? "" : "not ", "ok 13 # $s\n"; 152 print $s == 0 ? "" : "not ", "ok 13 # $s\n";
153} 153}
154 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
155print "ok 14\n"; 170print "ok 15\n";
156 171
157exit 0; 172exit 0;
158 173

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines