From 0c09462e4dfc5d421f1e084f8d943bae00cd877e Mon Sep 17 00:00:00 2001 From: ablangy <32962735+ablangy@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:34:07 +0100 Subject: [PATCH] exitWithDefaultSignalHandler() should block until signal handler returns (#464) raise() system call does the same as kill() system call in a single-threaded program. In a multithreaded program, it does the same as pthread_kill() which ensures that if the signal causes a handler to be called, raise() will return only after the signal handler has returned. --- src/crashhandler_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crashhandler_unix.cpp b/src/crashhandler_unix.cpp index ea2f073..004a299 100644 --- a/src/crashhandler_unix.cpp +++ b/src/crashhandler_unix.cpp @@ -230,7 +230,7 @@ namespace g3 { std::cerr << "\n\n" << __FUNCTION__ << ":" << __LINE__ << ". Exiting due to " << level.text << ", " << signal_number << " \n\n" << std::flush; - kill(getpid(), signal_number); + raise(signal_number); // When running as PID1 the above kill doesn't have any effect (execution simply passes through it, contrary // to a non-PID1 process where execution stops at kill and switches over to signal handling). Also as PID1