From 93b5278a34bcdbba5f73014a4e3fde42cabce099 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 16 Feb 2018 10:09:54 +0000 Subject: [PATCH] Don't bypass queue cycle in emergency_stop. Rather than calling stopped() directly from emergency_stop(), wait for the transition cycle. --- src/baseproc-service.cc | 1 - src/includes/proc-service.h | 3 +++ src/includes/service.h | 2 +- src/service.cc | 6 ++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/baseproc-service.cc b/src/baseproc-service.cc index 2c94204..7995087 100644 --- a/src/baseproc-service.cc +++ b/src/baseproc-service.cc @@ -328,7 +328,6 @@ void base_process_service::emergency_stop() noexcept } forced_stop(); stop_dependents(); - stopped(); } void base_process_service::becoming_inactive() noexcept diff --git a/src/includes/proc-service.h b/src/includes/proc-service.h index 2a46f02..bd78ae7 100644 --- a/src/includes/proc-service.h +++ b/src/includes/proc-service.h @@ -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). diff --git a/src/includes/service.h b/src/includes/service.h index e7f96a5..50a488a 100644 --- a/src/includes/service.h +++ b/src/includes/service.h @@ -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 diff --git a/src/service.cc b/src/service.cc index fb27d81..1cbd504 100644 --- a/src/service.cc +++ b/src/service.cc @@ -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); + } } } -- 2.25.1