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.3 by root, Mon Feb 18 21:25:02 2002 UTC vs.
Revision 1.4 by root, Fri Nov 24 15:34:33 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines