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

TD-1207

上级 f8ee5fc4
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册