ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro.pm
(Generate patch)

Comparing Coro/Coro.pm (file contents):
Revision 1.83 by root, Fri Nov 24 15:34:33 2006 UTC vs.
Revision 1.85 by root, Sat Nov 25 00:56:35 2006 UTC

184 184
185=cut 185=cut
186 186
187sub async(&@) { 187sub 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
196Calls the scheduler. Please note that the current process will not be put 195Calls the scheduler. Please note that the current process will not be put
234called. To make the process run you must first put it into the ready queue 233called. To make the process run you must first put it into the ready queue
235by calling the ready method. 234by calling the ready method.
236 235
237=cut 236=cut
238 237
239sub _newcoro { 238sub _new_coro {
239 $current->_clear_idle_sp; # set the idle sp on the following cede
240 _set_cede_self; # ensures that cede cede's us first
241 cede;
240 terminate &{+shift}; 242 terminate &{+shift};
241} 243}
242 244
243sub new { 245sub new {
244 my $class = shift; 246 my $class = shift;
245 247
246 $class->SUPER::new (\&_newcoro, @_) 248 $class->SUPER::new (\&_new_coro, @_)
247} 249}
248 250
249=item $process->ready 251=item $process->ready
250 252
251Put the given process into the ready queue. 253Put the given process into the ready queue.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines