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