Browse Source

Actually handle signals with a graceful shutdown in ckdb

master
Con Kolivas 10 years ago
parent
commit
d84d5ea5ac
  1. 8
      src/ckdb.c

8
src/ckdb.c

@ -10263,6 +10263,13 @@ static struct option long_options[] = {
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
static void sighandler(int sig)
{
LOGWARNING("Received signal %d, shutting down", sig);
cksleep_ms(420);
exit(0);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct sigaction handler; struct sigaction handler;
@ -10426,6 +10433,7 @@ int main(int argc, char **argv)
create_pthread(&ckp.pth_listener, listener, &ckp.main); create_pthread(&ckp.pth_listener, listener, &ckp.main);
handler.sa_handler = sighandler;
handler.sa_flags = 0; handler.sa_flags = 0;
sigemptyset(&handler.sa_mask); sigemptyset(&handler.sa_mask);
sigaction(SIGTERM, &handler, NULL); sigaction(SIGTERM, &handler, NULL);

Loading…
Cancel
Save