From f3cf22b436f8f3e20a9b2f9256ff7c58aa0afda3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Aug 2014 02:29:52 +0200 Subject: misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-base.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/mds-base.c') diff --git a/src/mds-base.c b/src/mds-base.c index 95eb4e0..572202e 100644 --- a/src/mds-base.c +++ b/src/mds-base.c @@ -265,11 +265,29 @@ void received_noop(int signo) } +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +/** + * This function should be implemented by the actual server implementation + * if the server is multi-threaded + * + * Send a singal to all threads except the current thread + * + * @param signo The signal + */ +void __attribute__((weak)) signal_all(int signo) +{ + (void) signo; +} +# pragma GCC diagnostic pop + + /** * This function is called when a signal that * signals the server to re-exec has been received * - * When this function is invoked, it should set `reexecing` to a non-zero value + * When this function is invoked, it should set `reexecing` and + * `terminating` to a non-zero value * * @param signo The signal that has been received */ @@ -278,8 +296,9 @@ void __attribute__((weak)) received_reexec(int signo) (void) signo; if (reexecing == 0) { - reexecing = 1; + reexecing = terminating = 1; eprint("re-exec signal received."); + signal_all(signo); } } @@ -299,6 +318,7 @@ void __attribute__((weak)) received_terminate(int signo) { terminating = 1; eprint("terminate signal received."); + signal_all(signo); } } -- cgit v1.2.3-70-g09d2