Don't bypass queue cycle in emergency_stop.
authorDavin McCall <davmac@davmac.org>
Fri, 16 Feb 2018 10:09:54 +0000 (10:09 +0000)
committerDavin McCall <davmac@davmac.org>
Fri, 16 Feb 2018 10:09:54 +0000 (10:09 +0000)
Rather than calling stopped() directly from emergency_stop(), wait for
the transition cycle.

src/baseproc-service.cc
src/includes/proc-service.h
src/includes/service.h
src/service.cc

index 2c94204f77eb648c886e86a5933a3393a07e37af..79950870e462287d16eb7953ee336a0b175250d3 100644 (file)
@@ -328,7 +328,6 @@ void base_process_service::emergency_stop() noexcept
     }
     forced_stop();
     stop_dependents();
-    stopped();
 }
 
 void base_process_service::becoming_inactive() noexcept
index 2a46f02ac5f0f1e0e91b622c7cb8669b16edf1a6..bd78ae76646ee643cd2ab210502c2a5b71fef9b5 100644 (file)
@@ -2,6 +2,9 @@
 
 #include "service.h"
 
+// This header defines base_proc_service (base process service) and several derivatives, as well as some
+// utility functions and classes. See service.h for full details of services.
+
 // Given a string and a list of pairs of (start,end) indices for each argument in that string,
 // store a null terminator for the argument. Return a `char *` vector containing the beginning
 // of each argument and a trailing nullptr. (The returned array is invalidated if the string is later modified).
index e7f96a50e61daa17af68ca79e55c2101bff95105..50a488ac5437ddecea2b7714737f5bdf5bc8a6e7 100644 (file)
@@ -401,7 +401,7 @@ class service_record
     // Called on transition of desired state from stopped to started (or unpinned stop)
     void do_start() noexcept;
 
-    // Called on transition of desired state from started to stopped (or unpinned start)
+    // Begin stopping, release activation.
     void do_stop() noexcept;
 
     // Set the service state
index fb27d81a713d52f0ee5019b7bb8a397536a567a1..1cbd5044911c6514eca84edf0cc9004c768088d5 100644 (file)
@@ -328,7 +328,6 @@ void service_record::acquired_console() noexcept
     }
 }
 
-
 void service_record::started() noexcept
 {
     // If we start on console but don't keep it, release it now:
@@ -416,7 +415,10 @@ void service_record::forced_stop() noexcept
 {
     if (service_state != service_state_t::STOPPED) {
         force_stop = true;
-        services->add_transition_queue(this);
+        if (! pinned_started) {
+            prop_stop = true;
+            services->add_transition_queue(this);
+        }
     }
 }