… | |
… | |
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 | loop; |
10 | =head1 DESCRIPTION |
11 | |
11 | |
12 | =head1 DESCRIPTION |
12 | This module does two things: First, it offers some utility functions that |
|
|
13 | might be useful for coroutines, and secondly, it integrates Coro into the |
|
|
14 | EV main loop: |
|
|
15 | |
|
|
16 | Before the process blocks (in EV::loop) to wait for events, this module |
|
|
17 | will schedule and run all ready (= runnable) coroutines of the same or |
|
|
18 | higher priority. After that, it will cede once to a coroutine of lower |
|
|
19 | priority, then continue in the event loop. |
|
|
20 | |
|
|
21 | That means that coroutines with the same or higher pripority as the |
|
|
22 | coroutine running the main loop will inhibit event processing, while |
|
|
23 | coroutines of lower priority will get the CPU, but cannot completeley |
|
|
24 | inhibit event processing. |
13 | |
25 | |
14 | =head1 FUNCTIONS |
26 | =head1 FUNCTIONS |
15 | |
27 | |
16 | =over 4 |
28 | =over 4 |
17 | |
29 | |
… | |
… | |
72 | &_timer_once; |
84 | &_timer_once; |
73 | do { &Coro::schedule } while !$#_; |
85 | do { &Coro::schedule } while !$#_; |
74 | pop |
86 | pop |
75 | } |
87 | } |
76 | |
88 | |
77 | #sub timer_abs_once($$) { |
|
|
78 | # &_timer_abs_once; |
|
|
79 | # do { &Coro::schedule } while !$#_; |
|
|
80 | # pop |
|
|
81 | #} |
|
|
82 | |
|
|
83 | 1; |
89 | 1; |
84 | |
90 | |
85 | =back |
91 | =back |
86 | |
92 | |
87 | =head1 AUTHOR |
93 | =head1 AUTHOR |