… | |
… | |
2 | |
2 | |
3 | Coro::Timer - simple timer package, independent of used event loops |
3 | Coro::Timer - simple timer package, independent of used event loops |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Coro::Timer; |
7 | use Coro::Timer qw(sleep timeout); |
|
|
8 | # nothing exported by default |
|
|
9 | |
|
|
10 | sleep 10; |
8 | |
11 | |
9 | =head1 DESCRIPTION |
12 | =head1 DESCRIPTION |
10 | |
13 | |
11 | This package implements a simple timer callback system which works |
14 | This package implements a simple timer callback system which works |
12 | independent of the event loop mechanism used. If no event mechanism is |
15 | independent of the event loop mechanism used. If no event mechanism is |
… | |
… | |
30 | |
33 | |
31 | BEGIN { |
34 | BEGIN { |
32 | eval "use Time::HiRes 'time'"; |
35 | eval "use Time::HiRes 'time'"; |
33 | } |
36 | } |
34 | |
37 | |
35 | $VERSION = 0.532; |
38 | $VERSION = 0.533; |
36 | @EXPORT_OK = qw(timeout sleep); |
39 | @EXPORT_OK = qw(timeout sleep); |
37 | |
40 | |
38 | =item $flag = timeout $seconds; |
41 | =item $flag = timeout $seconds; |
39 | |
42 | |
40 | This function will wake up the current coroutine after $seconds |
43 | This function will wake up the current coroutine after $seconds |