mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-24 06:15:57 +03:00
now blocking SIGINT and SIGTERM in restart function. the child
should handle the signal and terminate. then the restart function will exit.
This commit is contained in:
parent
a65bb19723
commit
b83c0c5928
@ -109,6 +109,13 @@ CUnixPlatform::installDaemonLogger(const char* name)
|
||||
int
|
||||
CUnixPlatform::restart(RestartFunc func, int minErrorCode)
|
||||
{
|
||||
// rely on child to catch these signals
|
||||
sigset_t sigset;
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGINT);
|
||||
sigaddset(&sigset, SIGTERM);
|
||||
pthread_sigmask(SIG_BLOCK, &sigset, NULL);
|
||||
|
||||
for (;;) {
|
||||
switch (fork()) {
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user