… | |
… | |
254 | |
254 | |
255 | Calling C<exit> in a coroutine will not work correctly, so do not do that. |
255 | Calling C<exit> in a coroutine will not work correctly, so do not do that. |
256 | |
256 | |
257 | =cut |
257 | =cut |
258 | |
258 | |
259 | sub _new_coro { |
259 | sub _run_coro { |
260 | terminate &{+shift}; |
260 | terminate &{+shift}; |
261 | } |
261 | } |
262 | |
262 | |
263 | sub new { |
263 | sub new { |
264 | my $class = shift; |
264 | my $class = shift; |
265 | |
265 | |
266 | $class->SUPER::new (\&_new_coro, @_) |
266 | $class->SUPER::new (\&_run_coro, @_) |
267 | } |
267 | } |
268 | |
268 | |
269 | =item $success = $coroutine->ready |
269 | =item $success = $coroutine->ready |
270 | |
270 | |
271 | Put the given coroutine into the ready queue (according to it's priority) |
271 | Put the given coroutine into the ready queue (according to it's priority) |