diff options
author | Eric Wong <e@80x24.org> | 2023-01-21 08:58:19 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-21 16:33:22 +0000 |
commit | fa5aad1d5f3c5abaa28a49181674930f2e06066e (patch) | |
tree | cd7ceaa55d76d71af07f4b0907b95599cd7053f8 /lib | |
parent | 5a52841422b46646c1e6d2f93c8c14d1d24a0544 (diff) | |
download | public-inbox-fa5aad1d5f3c5abaa28a49181674930f2e06066e.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/DS.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 523d47e4..0a763d0e 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -699,8 +699,8 @@ sub long_response ($$;@) { } sub awaitpid { - 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; @@ -716,9 +716,9 @@ again: 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; } 1; |