--- cvsroot/Coro/Coro.pm 2007/09/22 22:39:15 1.135 +++ cvsroot/Coro/Coro.pm 2007/09/26 19:27:04 1.138 @@ -52,7 +52,7 @@ our $main; # main coroutine our $current; # current coroutine -our $VERSION = '3.7'; +our $VERSION = '3.8'; our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); our %EXPORT_TAGS = ( @@ -157,6 +157,10 @@ for @{(delete $self->{destroy_cb}) || []}; } +sub _do_trace { + $current->{_trace_cb}->(); +} + # this coroutine is necessary because a coroutine # cannot destroy itself. my @destroy; @@ -243,16 +247,14 @@ while () { eval { while () { -# &{&_pool_1 or &terminate}; # crashes, would be ~5% faster - $cb = &_pool_1 - or &terminate; + _pool_1 $cb; &$cb; - undef $cb; - &terminate if &_pool_2; + _pool_2 $cb; &schedule; } }; + last if $@ eq "\3terminate\2\n"; warn $@ if $@; } }