From 5d9ebb25b0f84c4543bb2cbb82cb2ff3b227fcd5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 17 Jan 2021 20:47:53 +0800 Subject: [PATCH] TD-1207 --- src/dnode/src/dnodeSystem.c | 14 ++++++++------ src/os/inc/osSignal.h | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/dnode/src/dnodeSystem.c b/src/dnode/src/dnodeSystem.c index bdaecf2e0f..3a50eca9e6 100644 --- a/src/dnode/src/dnodeSystem.c +++ b/src/dnode/src/dnodeSystem.c @@ -120,6 +120,7 @@ int32_t main(int32_t argc, char *argv[]) { taosSetSignal(SIGHUP, sigintHandler); taosSetSignal(SIGINT, sigintHandler); taosSetSignal(SIGABRT, sigintHandler); + taosSetSignal(SIGBREAK, sigintHandler); // Open /var/log/syslog file to record information. openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1); @@ -152,12 +153,6 @@ static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 1 static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); } static void sigintHandler(int32_t signum) { - // clean the system. - dInfo("shut down signal is %d", signum); - - syslog(LOG_INFO, "Shut down signal is %d", signum); - syslog(LOG_INFO, "Shutting down TDengine service..."); - // protect the application from receive another signal taosIgnSignal(SIGUSR1); taosIgnSignal(SIGUSR2); @@ -165,6 +160,13 @@ static void sigintHandler(int32_t signum) { taosIgnSignal(SIGHUP); taosIgnSignal(SIGINT); taosIgnSignal(SIGABRT); + taosIgnSignal(SIGBREAK); + + // clean the system. + dInfo("shut down signal is %d", signum); + + syslog(LOG_INFO, "Shut down signal is %d", signum); + syslog(LOG_INFO, "Shutting down TDengine service..."); // inform main thread to exit tsem_post(&exitSem); diff --git a/src/os/inc/osSignal.h b/src/os/inc/osSignal.h index 8b047b9e25..57582a8a28 100644 --- a/src/os/inc/osSignal.h +++ b/src/os/inc/osSignal.h @@ -44,6 +44,10 @@ extern "C" { #define SIGUSR2 1234 #endif +#ifndef SIGBREAK + #define SIGBREAK 1234 +#endif + typedef void (*FSignalHandler)(int32_t signum); void taosSetSignal(int32_t signum, FSignalHandler sigfp); void taosIgnSignal(int32_t signum); -- GitLab