ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/t/09_timer.t
(Generate patch)

Comparing Coro/t/09_timer.t (file contents):
Revision 1.1 by root, Sun Nov 25 20:04:06 2001 UTC vs.
Revision 1.2 by root, Tue Nov 27 02:51:04 2001 UTC

1$|=1; 1$|=1;
2print "1..6\n"; 2print "1..8\n";
3 3
4use Coro; 4use Coro;
5use Coro::Signal;
5use Coro::Timer; 6use Coro::Timer;
6 7
7print "ok 1\n"; 8print "ok 1\n";
8 9
10my $signal = new Coro::Signal;
11
9new Coro::Timer after => 0, cb => sub { 12new Coro::Timer after => 0, cb => sub {
10 print "ok 2\n"; 13 print "ok 2\n";
11}; 14};
12new Coro::Timer after => 1, cb => sub { 15new Coro::Timer at => time + 1, cb => sub {
13 print "ok 4\n"; 16 print "ok 4\n";
17};
18new Coro::Timer after => 2, cb => sub {
19 $signal->send;
14}; 20};
15new Coro::Timer after => 0, cb => sub { 21new Coro::Timer after => 0, cb => sub {
16 print "ok 3\n"; 22 print "ok 3\n";
17}; 23};
18(new Coro::Timer after => 0, cb => sub { 24(new Coro::Timer after => 0, cb => sub {
19 print "not ok 4\n"; 25 print "not ok 4\n";
20})->cancel; 26})->cancel;
21new Coro::Timer at => time + 2, cb => sub { 27new Coro::Timer at => time + 3, cb => sub {
22 print "ok 5\n"; 28 print "ok 7\n";
23 $Coro::main->ready; 29 $Coro::main->ready;
24}; 30};
25 31
32print $signal->timed_wait(1) ? "not ok" : "ok", " 5\n";
33print $signal->timed_wait(1) ? "ok" : "not ok", " 6\n";
26schedule; 34schedule;
27print "ok 6\n"; 35print "ok 8\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines