From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] ipc: support awaitpid in WQ workers
Date: Fri, 31 Mar 2023 01:43:44 +0000 [thread overview]
Message-ID: <20230331014344.712299-1-e@80x24.org> (raw)
---
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
next reply other threads:[~2023-03-31 1:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 1:43 Eric Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-03-31 1:44 [PATCH] ipc: support awaitpid in WQ workers Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230331014344.712299-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).