* [PATCH 4/4] cindex: leave SIGTSTP and SIGCONT unblocked
2023-03-28 2:59 6% [PATCH 0/4] cindex updates Eric Wong
@ 2023-03-28 2:59 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-03-28 2:59 UTC (permalink / raw)
To: meta
This makes it easier to pause and restart long-running indexing
jobs which use our event loop.
---
lib/PublicInbox/CodeSearchIdx.pm | 3 ++-
lib/PublicInbox/DS.pm | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index f60af015..8d57ec10 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -841,7 +841,8 @@ sub cidx_run { # main entry point
my ($self) = @_;
my $restore_umask = prep_umask($self);
local $DEFER = [];
- local $SIGSET = PublicInbox::DS::block_signals();
+ local $SIGSET = PublicInbox::DS::block_signals(
+ POSIX::SIGTSTP, POSIX::SIGCONT);
my $restore = PublicInbox::OnDestroy->new($$,
\&PublicInbox::DS::sig_setmask, $SIGSET);
local $LIVE = {};
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 340086fc..98084b5c 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -193,10 +193,11 @@ sub RunTimers {
sub sig_setmask { sigprocmask(SIG_SETMASK, @_) or die "sigprocmask: $!" }
-sub block_signals () {
- my $oldset = POSIX::SigSet->new;
+sub block_signals { # anything in @_ stays unblocked
my $newset = POSIX::SigSet->new;
$newset->fillset or die "fillset: $!";
+ $newset->delset($_) for @_;
+ my $oldset = POSIX::SigSet->new;
sig_setmask($newset, $oldset);
$oldset;
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] cindex updates
@ 2023-03-28 2:59 6% Eric Wong
2023-03-28 2:59 7% ` [PATCH 4/4] cindex: leave SIGTSTP and SIGCONT unblocked Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-03-28 2:59 UTC (permalink / raw)
To: meta
cindex --prune is less intrusive w.r.t. handling new
commits, now.
I'm embracing `local' more because this is a Perl codebase;
and I think it makes things more robust against typos.
I probably should've been doing this years ago :x
Eric Wong (4):
cindex: simplify some internal data structures
cindex: always break out of event loop on $DO_QUIT
cindex: interleave prune with indexing
cindex: leave SIGTSTP and SIGCONT unblocked
lib/PublicInbox/CodeSearchIdx.pm | 298 ++++++++++++++++++++-----------
lib/PublicInbox/DS.pm | 5 +-
lib/PublicInbox/SearchIdx.pm | 12 +-
script/public-inbox-cindex | 2 +-
4 files changed, 210 insertions(+), 107 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-03-28 2:59 6% [PATCH 0/4] cindex updates Eric Wong
2023-03-28 2:59 7% ` [PATCH 4/4] cindex: leave SIGTSTP and SIGCONT unblocked Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).