… | |
… | |
234 | called. To make the process run you must first put it into the ready queue |
234 | called. To make the process run you must first put it into the ready queue |
235 | by calling the ready method. |
235 | by calling the ready method. |
236 | |
236 | |
237 | =cut |
237 | =cut |
238 | |
238 | |
239 | sub _newcoro { |
239 | sub _new_coro { |
|
|
240 | # $current->_clear_idle_sp; # set the idle sp on the following cede |
|
|
241 | _set_cede_self; # ensures that cede cede's us first |
|
|
242 | cede; |
240 | terminate &{+shift}; |
243 | terminate &{+shift}; |
241 | } |
244 | } |
242 | |
245 | |
243 | sub new { |
246 | sub new { |
244 | my $class = shift; |
247 | my $class = shift; |
245 | |
248 | |
246 | $class->SUPER::new (\&_newcoro, @_) |
249 | $class->SUPER::new (\&_new_coro, @_) |
247 | } |
250 | } |
248 | |
251 | |
249 | =item $process->ready |
252 | =item $process->ready |
250 | |
253 | |
251 | Put the given process into the ready queue. |
254 | Put the given process into the ready queue. |