… | |
… | |
184 | |
184 | |
185 | =cut |
185 | =cut |
186 | |
186 | |
187 | sub async(&@) { |
187 | sub async(&@) { |
188 | my $pid = new Coro @_; |
188 | my $pid = new Coro @_; |
189 | $manager->ready; # this ensures that the stack is cloned from the manager |
|
|
190 | $pid->ready; |
189 | $pid->ready; |
191 | $pid; |
190 | $pid |
192 | } |
191 | } |
193 | |
192 | |
194 | =item schedule |
193 | =item schedule |
195 | |
194 | |
196 | Calls the scheduler. Please note that the current process will not be put |
195 | Calls the scheduler. Please note that the current process will not be put |
… | |
… | |
235 | by calling the ready method. |
234 | by calling the ready method. |
236 | |
235 | |
237 | =cut |
236 | =cut |
238 | |
237 | |
239 | sub _new_coro { |
238 | sub _new_coro { |
240 | # $current->_clear_idle_sp; # set the idle sp on the following cede |
239 | $current->_clear_idle_sp; # set the idle sp on the following cede |
241 | _set_cede_self; # ensures that cede cede's us first |
240 | _set_cede_self; # ensures that cede cede's us first |
242 | cede; |
241 | cede; |
243 | terminate &{+shift}; |
242 | terminate &{+shift}; |
244 | } |
243 | } |
245 | |
244 | |