--- cvsroot/Coro/Coro.pm 2007/09/27 16:25:10 1.140 +++ cvsroot/Coro/Coro.pm 2007/10/02 10:38:17 1.141 @@ -310,12 +310,25 @@ Terminates the current coroutine with the given status values (see L). +=item killall + +Kills/terminates/cancels all coroutines except the currently running +one. This is useful after a fork, either in the child or the parent, as +usually only one of them should inherit the running coroutines. + =cut sub terminate { $current->cancel (@_); } +sub killall { + for (Coro::State::list) { + $_->cancel + if $_ != $current && UNIVERSAL::isa $_, "Coro"; + } +} + =back # dynamic methods