mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
catching more signals
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@39 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
9d9d997dde
commit
6bb05021a2
5 changed files with 17 additions and 6 deletions
|
@ -57,10 +57,7 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
|
||||
sigemptyset(&sa_tick.sa_mask);
|
||||
|
||||
if (sigaction(SIG, &sa_tick, NULL)) {
|
||||
error("Failed sigaction(): %s", strerror(errno));
|
||||
}
|
||||
sigaction(SIG, &sa_tick, NULL);
|
||||
|
||||
/* Setup timer */
|
||||
timer_t t;
|
||||
|
|
|
@ -48,6 +48,7 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
|
||||
sigemptyset(&sa_quit.sa_mask);
|
||||
sigaction(SIGTERM, &sa_quit, NULL);
|
||||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
|
||||
/* Resolve address */
|
||||
|
|
|
@ -48,6 +48,7 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
|
||||
sigemptyset(&sa_quit.sa_mask);
|
||||
sigaction(SIGTERM, &sa_quit, NULL);
|
||||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
|
||||
/* Resolve address */
|
||||
|
|
15
src/server.c
15
src/server.c
|
@ -82,8 +82,19 @@ int main(int argc, char *argv[])
|
|||
path_start(&config.paths[i]);
|
||||
}
|
||||
|
||||
signal(SIGINT, quit);
|
||||
pause();
|
||||
/* Start and connect all paths/nodes */
|
||||
/* Setup signals */
|
||||
struct sigaction sa_quit = {
|
||||
.sa_flags = SA_SIGINFO,
|
||||
.sa_sigaction = quit
|
||||
};
|
||||
|
||||
sigemptyset(&sa_quit.sa_mask);
|
||||
sigaction(SIGTERM, &sa_quit, NULL);
|
||||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
|
||||
/* Main thread is sleeping */
|
||||
while (1) pause();
|
||||
|
||||
quit();
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
|
||||
sigemptyset(&sa_quit.sa_mask);
|
||||
sigaction(SIGTERM, &sa_quit, NULL);
|
||||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
|
||||
/* Resolve address */
|
||||
|
|
Loading…
Add table
Reference in a new issue