mirror of https://github.com/debauchee/barrier.git
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