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

Comparing Coro/Coro.pm (file contents):
Revision 1.138 by root, Wed Sep 26 19:27:04 2007 UTC vs.
Revision 1.141 by root, Tue Oct 2 10:38:17 2007 UTC

155 # call all destruction callbacks 155 # call all destruction callbacks
156 $_->(@{$self->{status}}) 156 $_->(@{$self->{status}})
157 for @{(delete $self->{destroy_cb}) || []}; 157 for @{(delete $self->{destroy_cb}) || []};
158} 158}
159 159
160sub _do_trace {
161 $current->{_trace_cb}->();
162}
163
164# this coroutine is necessary because a coroutine 160# this coroutine is necessary because a coroutine
165# cannot destroy itself. 161# cannot destroy itself.
166my @destroy; 162my @destroy;
167my $manager; 163my $manager;
168 164
312 308
313=item terminate [arg...] 309=item terminate [arg...]
314 310
315Terminates the current coroutine with the given status values (see L<cancel>). 311Terminates the current coroutine with the given status values (see L<cancel>).
316 312
313=item killall
314
315Kills/terminates/cancels all coroutines except the currently running
316one. This is useful after a fork, either in the child or the parent, as
317usually only one of them should inherit the running coroutines.
318
317=cut 319=cut
318 320
319sub terminate { 321sub terminate {
320 $current->cancel (@_); 322 $current->cancel (@_);
323}
324
325sub killall {
326 for (Coro::State::list) {
327 $_->cancel
328 if $_ != $current && UNIVERSAL::isa $_, "Coro";
329 }
321} 330}
322 331
323=back 332=back
324 333
325# dynamic methods 334# dynamic methods

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines