提交 5d9ebb25 编写于 作者: S Shengliang Guan

TD-1207

上级 f8ee5fc4
...@@ -120,6 +120,7 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -120,6 +120,7 @@ int32_t main(int32_t argc, char *argv[]) {
taosSetSignal(SIGHUP, sigintHandler); taosSetSignal(SIGHUP, sigintHandler);
taosSetSignal(SIGINT, sigintHandler); taosSetSignal(SIGINT, sigintHandler);
taosSetSignal(SIGABRT, sigintHandler); taosSetSignal(SIGABRT, sigintHandler);
taosSetSignal(SIGBREAK, sigintHandler);
// Open /var/log/syslog file to record information. // Open /var/log/syslog file to record information.
openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1); openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1);
...@@ -152,12 +153,6 @@ static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 1 ...@@ -152,12 +153,6 @@ static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 1
static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); } static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); }
static void sigintHandler(int32_t signum) { 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 // protect the application from receive another signal
taosIgnSignal(SIGUSR1); taosIgnSignal(SIGUSR1);
taosIgnSignal(SIGUSR2); taosIgnSignal(SIGUSR2);
...@@ -165,6 +160,13 @@ static void sigintHandler(int32_t signum) { ...@@ -165,6 +160,13 @@ static void sigintHandler(int32_t signum) {
taosIgnSignal(SIGHUP); taosIgnSignal(SIGHUP);
taosIgnSignal(SIGINT); taosIgnSignal(SIGINT);
taosIgnSignal(SIGABRT); 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 // inform main thread to exit
tsem_post(&exitSem); tsem_post(&exitSem);
......
...@@ -44,6 +44,10 @@ extern "C" { ...@@ -44,6 +44,10 @@ extern "C" {
#define SIGUSR2 1234 #define SIGUSR2 1234
#endif #endif
#ifndef SIGBREAK
#define SIGBREAK 1234
#endif
typedef void (*FSignalHandler)(int32_t signum); typedef void (*FSignalHandler)(int32_t signum);
void taosSetSignal(int32_t signum, FSignalHandler sigfp); void taosSetSignal(int32_t signum, FSignalHandler sigfp);
void taosIgnSignal(int32_t signum); void taosIgnSignal(int32_t signum);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册