1Timer(3)              User Contributed Perl Documentation             Timer(3)
2
3
4

NAME

6       Coro::Timer - timers and timeouts, independent of any event loop
7

SYNOPSIS

9        # This package is mostly obsoleted by Coro::AnyEvent.
10
11        use Coro::Timer qw(timeout);
12        # nothing exported by default
13

DESCRIPTION

15       This package has been mostly obsoleted by Coro::AnyEvent, the only
16       really useful function left in here is "timeout".
17
18       $flag = timeout $seconds
19           This function will wake up the current coroutine after $seconds
20           seconds and sets $flag to true (it is false initially).  If $flag
21           goes out of scope earlier then nothing happens.
22
23           This is used by Coro itself to implement the "timed_down",
24           "timed_wait" etc. primitives. It is used like this:
25
26              sub timed_wait {
27                 my $timeout = Coro::Timer::timeout 60;
28
29                 while (condition false) {
30                    Coro::schedule; # wait until woken up or timeout
31                    return 0 if $timeout; # timed out
32                 }
33
34                 return 1; # condition satisfied
35              }
36

AUTHOR/SUPPORT/CONTACT

38          Marc A. Lehmann <schmorp@schmorp.de>
39          http://software.schmorp.de/pkg/Coro.html
40
41
42
43perl v5.28.0                      2017-08-31                          Timer(3)
Impressum