From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Flag: YES X-Spam-Level: ******** X-Spam-ASN: AS60729 185.220.102.0/24 X-Spam-Status: Yes, score=8.0 required=3.0 tests=AWL,BAYES_00, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI, RCVD_IN_PBL,RCVD_IN_SBL_CSS,RCVD_IN_XBL,RDNS_NONE,SPF_FAIL, SPF_HELO_FAIL,TO_EQ_FM_DOM_SPF_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.6 X-Spam-Report: * 3.3 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL * [185.220.102.247 listed in zen.spamhaus.org] * 0.4 RCVD_IN_XBL RBL: Received via a relay in Spamhaus XBL * 3.3 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS * 1.3 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in * bl.spamcop.net * [Blocked - see ] * -3.0 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 SPF_HELO_FAIL SPF: HELO does not match SPF record (fail) * [SPF failed: Rejected by SPF record] * 0.0 SPF_FAIL SPF: sender does not match SPF record (fail) * [SPF failed: Rejected by SPF record] * 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS * 0.0 RCVD_IN_MSPIKE_BL Mailspike blocklisted * 2.7 RCVD_IN_MSPIKE_ZBI No description available. * 0.0 TO_EQ_FM_DOM_SPF_FAIL To domain == From domain and external SPF * failed * -0.9 AWL AWL: Adjusted score from AWL reputation of From: address Received: from 80x24.org (unknown [185.220.102.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 457DF1F452 for ; Fri, 31 Mar 2023 01:44:19 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] ipc: support awaitpid in WQ workers Date: Fri, 31 Mar 2023 01:44:12 +0000 Message-Id: <20230331014412.715242-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- lib/PublicInbox/IPC.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index 1f0e87ee..cca3dacb 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -268,12 +268,14 @@ sub sock_defined { defined($wqw->{sock}); } -sub wq_worker_loop ($$) { - my ($self, $bcast2) = @_; +sub wq_worker_loop ($$$) { + my ($self, $bcast2, $oldset) = @_; my $wqw = PublicInbox::WQWorker->new($self, $self->{-wq_s2}); PublicInbox::WQWorker->new($self, $bcast2) if $bcast2; local @PublicInbox::DS::post_loop_do = (\&sock_defined, $wqw); - PublicInbox::DS::event_loop(); + my $sig = delete($self->{wq_sig}); + $sig->{CHLD} //= \&PublicInbox::DS::enqueue_reap; + PublicInbox::DS::event_loop($sig, $oldset); PublicInbox::DS->Reset; } @@ -405,8 +407,7 @@ sub _wq_worker_start { local @$self{keys %$fields} = values(%$fields); my $on_destroy = $self->ipc_atfork_child; local @SIG{keys %SIG} = values %SIG; - PublicInbox::DS::sig_setmask($oldset); - wq_worker_loop($self, $bcast2); + wq_worker_loop($self, $bcast2, $oldset); }; warn "worker $self->{-wq_ident} PID:$$ died: $@" if $@; undef $end; # trigger exit