]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: leave SIGTSTP and SIGCONT unblocked
authorEric Wong <e@80x24.org>
Tue, 28 Mar 2023 02:59:04 +0000 (02:59 +0000)
committerEric Wong <e@80x24.org>
Wed, 29 Mar 2023 07:28:12 +0000 (07:28 +0000)
This makes it easier to pause and restart long-running indexing
jobs which use our event loop.

lib/PublicInbox/CodeSearchIdx.pm
lib/PublicInbox/DS.pm

index 6907570d63bf2fae9d3bb83e4ee66415d478dc0d..9e70087e11c3a4924541abf6bf80ebfb86a87b4c 100644 (file)
@@ -751,7 +751,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 = {};
index 340086fc885508c65973f49a1c43fea579784323..98084b5c8a0af713feef9370bd3c86fcbe795690 100644 (file)
@@ -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;
 }