… | |
… | |
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 |
44 | seconds and sets $flag to true (it is false intiially). If $flag goes |
44 | seconds and sets $flag to true (it is false initially). If $flag goes |
45 | out of scope earlier nothing happens. This is used to implement the |
45 | out of scope earlier nothing happens. This is used to implement the |
46 | C<timed_down>, C<timed_wait> etc. primitives. It is used like this: |
46 | C<timed_down>, C<timed_wait> etc. primitives. It is used like this: |
47 | |
47 | |
48 | sub timed_wait { |
48 | sub timed_wait { |
49 | my $timeout = Coro::Timer::timeout 60; |
49 | my $timeout = Coro::Timer::timeout 60; |