about summary refs log tree commit homepage
path: root/lib/PublicInbox/ExtSearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-01 09:54:41 +0000
committerEric Wong <e@80x24.org>2021-10-01 12:06:31 +0000
commit1c52f49354aa83e71fcceccae888da0c77f2391d (patch)
treebd6eabaed8cc0376e4a56cb6ec34cf962fd7ffdb /lib/PublicInbox/ExtSearchIdx.pm
parent5824d0d4ffac120a2840c980b4570868d6b3ea6b (diff)
downloadpublic-inbox-1c52f49354aa83e71fcceccae888da0c77f2391d.tar.gz
Since signalfd is often combined with our event loop, give it a
convenient API and reduce the code duplication required to use it.

EventLoop is replaced with ::event_loop to allow consistent
parameter passing and avoid needlessly passing the package name
on stack.

We also avoid exporting SFD_NONBLOCK since it's the only flag we
support.  There's no sense in having the memory overhead of a
constant function when it's in cold code.
Diffstat (limited to 'lib/PublicInbox/ExtSearchIdx.pm')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 6b29789a..c34225b2 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -1305,19 +1305,11 @@ sub eidx_watch { # public-inbox-extindex --watch main loop
         };
         my $quit = PublicInbox::SearchIdx::quit_cb($sync);
         $sig->{QUIT} = $sig->{INT} = $sig->{TERM} = $quit;
-        my $sigfd = PublicInbox::Sigfd->new($sig,
-                                        $PublicInbox::Syscall::SFD_NONBLOCK);
-        @SIG{keys %$sig} = values(%$sig) if !$sigfd;
         local $self->{-watch_sync} = $sync; # for ->on_inbox_unlock
-        if (!$sigfd) {
-                # wake up every second to accept signals if we don't
-                # have signalfd or IO::KQueue:
-                PublicInbox::DS::sig_setmask($oldset);
-                PublicInbox::DS->SetLoopTimeout(1000);
-        }
         PublicInbox::DS->SetPostLoopCallback(sub { !$sync->{quit} });
         $pr->("initial scan complete, entering event loop\n") if $pr;
-        PublicInbox::DS->EventLoop; # calls InboxIdle->event_step
+        # calls InboxIdle->event_step:
+        PublicInbox::DS::event_loop($sig, $oldset);
         done($self);
 }