--- cvsroot/Coro/README 2008/12/15 20:52:04 1.21 +++ cvsroot/Coro/README 2009/03/16 22:22:12 1.22 @@ -306,6 +306,30 @@ priority that were put into the ready queue earlier have been resumed. + $coro->suspend + Suspends the specified coro. A suspended coro works just like any + other coro, except that the scheduler will not select a suspended + coro for execution. + + Suspending a coro can be useful when you want to keep the coro from + running, but you don't want to destroy it, or when you want to + temporarily freeze a coro (e.g. for debugging) to resume it later. + + A scenario for the former would be to suspend all (other) coros + after a fork and keep them alive, so their destructors aren't + called, but new coros can be created. + + $coro->resume + If the specified coro was suspended, it will be resumed. Note that + when the coro was in the ready queue when it was suspended, it might + have been unreadied by the scheduler, so an activation might have + been lost. + + To avoid this, it is best to put a suspended coro into the ready + queue unconditionally, as every synchronisation mechanism must + protect itself against spurious wakeups, and the one in the Coro + family certainly do that. + $is_ready = $coro->is_ready Returns true iff the Coro object is in the ready queue. Unless the Coro object gets destroyed, it will eventually be scheduled by the