process service: more fixes to child watch reservation.
authorDavin McCall <davmac@davmac.org>
Mon, 26 Jun 2017 09:15:25 +0000 (10:15 +0100)
committerDavin McCall <davmac@davmac.org>
Mon, 26 Jun 2017 09:15:25 +0000 (10:15 +0100)
src/service.cc

index 54fe73d74a6a9e95f4d4d1485bee67a3b5fb13b0..b6d726acd703bf5f6c75d61cc9b08504f41ffbd7 100644 (file)
@@ -125,14 +125,15 @@ dasynq::rearm service_child_watcher::status_change(eventloop_t &loop, pid_t chil
     if (sr->waiting_for_execstat) {
         // We still don't have an exec() status from the forked child, wait for that
         // before doing any further processing.
-        return rearm::REMOVE;
+        return rearm::NOOP; // hold watch reservation
     }
     
-    // Must deregister now since handle_exit_status might result in re-launch:
-    deregister(loop, child);
+    // Must stop watch now since handle_exit_status might result in re-launch:
+    // (stop_watch instead of deregister, so that we hold watch reservation).
+    stop_watch(loop);
     
     sr->handle_exit_status(status);
-    return rearm::REMOVED;
+    return rearm::NOOP;
 }
 
 bool service_record::do_auto_restart() noexcept