… | |
… | |
22 | |
22 | |
23 | =cut |
23 | =cut |
24 | |
24 | |
25 | package Coro::Timer; |
25 | package Coro::Timer; |
26 | |
26 | |
27 | no warnings qw(uninitialized); |
27 | BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") } |
28 | |
28 | |
29 | use Carp (); |
29 | use Carp (); |
30 | use Exporter; |
30 | use Exporter; |
31 | |
31 | |
32 | use Coro (); |
32 | use Coro (); |
33 | |
33 | |
34 | BEGIN { |
34 | BEGIN { |
35 | eval "use Time::HiRes 'time'"; |
35 | eval "use Time::HiRes 'time'"; |
36 | } |
36 | } |
37 | |
37 | |
38 | $VERSION = 0.7; |
38 | $VERSION = 0.8; |
39 | @EXPORT_OK = qw(timeout sleep); |
39 | @EXPORT_OK = qw(timeout sleep); |
40 | |
40 | |
41 | =item $flag = timeout $seconds; |
41 | =item $flag = timeout $seconds; |
42 | |
42 | |
43 | This function will wake up the current coroutine after $seconds |
43 | This function will wake up the current coroutine after $seconds |