… | |
… | |
308 | |
308 | |
309 | =item terminate [arg...] |
309 | =item terminate [arg...] |
310 | |
310 | |
311 | Terminates the current coroutine with the given status values (see L<cancel>). |
311 | Terminates the current coroutine with the given status values (see L<cancel>). |
312 | |
312 | |
|
|
313 | =item killall |
|
|
314 | |
|
|
315 | Kills/terminates/cancels all coroutines except the currently running |
|
|
316 | one. This is useful after a fork, either in the child or the parent, as |
|
|
317 | usually only one of them should inherit the running coroutines. |
|
|
318 | |
313 | =cut |
319 | =cut |
314 | |
320 | |
315 | sub terminate { |
321 | sub terminate { |
316 | $current->cancel (@_); |
322 | $current->cancel (@_); |
|
|
323 | } |
|
|
324 | |
|
|
325 | sub killall { |
|
|
326 | for (Coro::State::list) { |
|
|
327 | $_->cancel |
|
|
328 | if $_ != $current && UNIVERSAL::isa $_, "Coro"; |
|
|
329 | } |
317 | } |
330 | } |
318 | |
331 | |
319 | =back |
332 | =back |
320 | |
333 | |
321 | # dynamic methods |
334 | # dynamic methods |