--- Coro/Coro.pm 2007/09/22 14:42:56 1.134 +++ Coro/Coro.pm 2007/09/26 19:26:48 1.137 @@ -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,25 +247,21 @@ while () { eval { while () { - $cb = &_pool_1 - or return; - + _pool_1 $cb; &$cb; - - return if &_pool_2; - - undef $cb; - schedule; + _pool_2 $cb; + &schedule; } }; + last if $@ eq "\3terminate\2\n"; warn $@ if $@; } } sub async_pool(&@) { # this is also inlined into the unlock_scheduler - my $coro = (pop @async_pool) || new Coro \&pool_handler;; + my $coro = (pop @async_pool) || new Coro \&pool_handler; $coro->{_invoke} = [@_]; $coro->ready;