From b83c0c5928dfd78bf6e8e3e1953d9fd149680e82 Mon Sep 17 00:00:00 2001 From: crs Date: Fri, 21 Jun 2002 15:15:34 +0000 Subject: [PATCH] now blocking SIGINT and SIGTERM in restart function. the child should handle the signal and terminate. then the restart function will exit. --- platform/CUnixPlatform.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/CUnixPlatform.cpp b/platform/CUnixPlatform.cpp index 21f61710..c1210458 100644 --- a/platform/CUnixPlatform.cpp +++ b/platform/CUnixPlatform.cpp @@ -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: