about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-08-31 04:41:39 +0000
committerEric Wong <e@80x24.org>2020-09-01 00:19:20 +0000
commit823dbcacf7829fd0f42748ae7712a76fa4c64a76 (patch)
treefaa940206dd352dbbf01bd4d94235de0554a496b
parent5fa34fad91d262f446465772dce9ac3dde9673bf (diff)
downloadpublic-inbox-823dbcacf7829fd0f42748ae7712a76fa4c64a76.tar.gz
It doesn't seem necessary, since we won't call dwaitpid()
until we see an EOF.
-rw-r--r--lib/PublicInbox/DS.pm13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index b252ea3c..661be1fd 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -40,7 +40,7 @@ my $wait_pids; # list of [ pid, callback, callback_arg ]
 my $later_queue; # list of callbacks to run at some later interval
 my $EXPMAP; # fd -> idle_time
 our $EXPTIME = 180; # 3 minutes
-my ($later_timer, $reap_armed, $reap_timer, $exp_timer);
+my ($later_timer, $reap_armed, $exp_timer);
 my $ToClose; # sockets to close when event loop is done
 our (
      %DescriptorMap,             # fd (num) -> PublicInbox::DS object
@@ -70,7 +70,7 @@ sub Reset {
     %DescriptorMap = ();
     $in_loop = $wait_pids = $later_queue = $reap_armed = undef;
     $EXPMAP = {};
-    $nextq = $ToClose = $reap_timer = $later_timer = $exp_timer = undef;
+    $nextq = $ToClose = $later_timer = $exp_timer = undef;
     $LoopTimeout = -1;  # no timeout by default
     @Timers = ();
 
@@ -240,14 +240,7 @@ sub reap_pids {
                 }
         }
         # we may not be done, yet, and could've missed/masked a SIGCHLD:
-        if ($wait_pids && !$reap_armed) {
-                $reap_timer //= add_timer(1, \&reap_pids_timed);
-        }
-}
-
-sub reap_pids_timed {
-        $reap_timer = undef;
-        goto \&reap_pids;
+        $reap_armed //= requeue(\&reap_pids) if $wait_pids;
 }
 
 # reentrant SIGCHLD handler (since reap_pids is not reentrant)