summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5a52841)
We must only write to $AWAIT_PIDS on the initial reap attempt.
While we're at it, avoid triggering an extra wakeup if we're
doing synchronous awaitpid. This seems to eliminate most
reliance on Qspawn->DESTROY to call Qspawn->finalize.
- my ($pid, @cb_args) = @_;
- $AWAIT_PIDS->{$pid} //= @cb_args ? \@cb_args : 0;
+ my ($pid, @cb_args) = @_; # @cb_args = ($cb, @args), $cb may be undef
+ $AWAIT_PIDS->{$pid} = \@cb_args if @cb_args;
# provide synchronous API
if (defined(wantarray) || (!$in_loop && !@cb_args)) {
my $ret;
# provide synchronous API
if (defined(wantarray) || (!$in_loop && !@cb_args)) {
my $ret;
delete $AWAIT_PIDS->{$pid};
}
return $ret;
delete $AWAIT_PIDS->{$pid};
}
return $ret;
+ } elsif ($in_loop) { # We could've just missed our SIGCHLD, cover it, here:
+ enqueue_reap();
- # We could've just missed our SIGCHLD, cover it, here:
- enqueue_reap() if $in_loop;