… | |
… | |
242 | last if @pool >= $POOL_SIZE; |
242 | last if @pool >= $POOL_SIZE; |
243 | push @pool, $current; |
243 | push @pool, $current; |
244 | |
244 | |
245 | $current->prio (0); |
245 | $current->prio (0); |
246 | schedule; |
246 | schedule; |
247 | } |
247 | } |
248 | } |
248 | } |
249 | |
249 | |
250 | sub async_pool(&@) { |
250 | sub async_pool(&@) { |
251 | # this is also inlined into the unlock_scheduler |
251 | # this is also inlined into the unlock_scheduler |
252 | my $coro = (pop @pool or new Coro \&pool_handler); |
252 | my $coro = (pop @pool or new Coro \&pool_handler); |
253 | |
253 | |
… | |
… | |
287 | |
287 | |
288 | "Cede" to other coroutines. This function puts the current coroutine into the |
288 | "Cede" to other coroutines. This function puts the current coroutine into the |
289 | ready queue and calls C<schedule>, which has the effect of giving up the |
289 | ready queue and calls C<schedule>, which has the effect of giving up the |
290 | current "timeslice" to other coroutines of the same or higher priority. |
290 | current "timeslice" to other coroutines of the same or higher priority. |
291 | |
291 | |
|
|
292 | Returns true if at least one coroutine switch has happened. |
|
|
293 | |
292 | =item Coro::cede_notself |
294 | =item Coro::cede_notself |
293 | |
295 | |
294 | Works like cede, but is not exported by default and will cede to any |
296 | Works like cede, but is not exported by default and will cede to any |
295 | coroutine, regardless of priority, once. |
297 | coroutine, regardless of priority, once. |
|
|
298 | |
|
|
299 | Returns true if at least one coroutine switch has happened. |
296 | |
300 | |
297 | =item terminate [arg...] |
301 | =item terminate [arg...] |
298 | |
302 | |
299 | Terminates the current coroutine with the given status values (see L<cancel>). |
303 | Terminates the current coroutine with the given status values (see L<cancel>). |
300 | |
304 | |