… | |
… | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Coro; |
7 | use Coro; |
8 | use Coro::EV; |
8 | use Coro::EV; |
9 | |
9 | |
|
|
10 | EV::READ & Coro::EV::timed_io_once $fh, EV::READ, 60 |
|
|
11 | or die "timeout\n"; |
|
|
12 | |
10 | EV::loop; |
13 | EV::loop; |
11 | |
14 | |
12 | =head1 DESCRIPTION |
15 | =head1 DESCRIPTION |
13 | |
16 | |
14 | This module does two things: First, it offers some utility functions that |
17 | This module does two things: First, it offers some utility functions that |
15 | might be useful for threads, and secondly, it integrates Coro into the |
18 | might be useful for threads (although L<Coro::AnyEvent> offers more and |
|
|
19 | more portable functions), and secondly, it integrates Coro into the EV |
16 | EV main loop: |
20 | main loop: |
17 | |
21 | |
18 | Before the process blocks (in EV::loop) to wait for events, this module |
22 | Before the process blocks (in EV::loop) to wait for events, this module |
19 | will schedule and run all ready (= runnable) threads of the same or |
23 | will schedule and run all ready (= runnable) threads of the same or |
20 | higher priority. After that, it will cede once to a threads of lower |
24 | higher priority. After that, it will cede once to a threads of lower |
21 | priority, then continue in the event loop. |
25 | priority, then continue in the event loop. |
… | |
… | |
76 | |
80 | |
77 | Blocks the coroutine until either the given event set has occured on the |
81 | Blocks the coroutine until either the given event set has occured on the |
78 | fd, or the timeout has been reached (if timeout is missing or C<undef> |
82 | fd, or the timeout has been reached (if timeout is missing or C<undef> |
79 | then there will be no timeout). Returns the received flags. |
83 | then there will be no timeout). Returns the received flags. |
80 | |
84 | |
|
|
85 | Consider using C<Coro::AnyEvent::readable> and C<Coro::AnyEvent::writable> |
|
|
86 | instead, they work with any AnyEvent-supported eventloop. |
|
|
87 | |
81 | =item Coro::EV::timer_once $after |
88 | =item Coro::EV::timer_once $after |
82 | |
89 | |
83 | Blocks the coroutine for at least C<$after> seconds. |
90 | Blocks the coroutine for at least C<$after> seconds. |
|
|
91 | |
|
|
92 | Consider using C<Coro::AnyEvent::sleep> instead, which works with any |
|
|
93 | AnyEvent-supported eventloop. |
84 | |
94 | |
85 | =cut |
95 | =cut |
86 | |
96 | |
87 | 1; |
97 | 1; |
88 | |
98 | |