Skip to content

Commit

Permalink
exitWithDefaultSignalHandler() should block until signal handler retu…
Browse files Browse the repository at this point in the history
…rns (#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.
  • Loading branch information
ablangy authored Nov 10, 2022
1 parent 2119575 commit 0c09462
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/crashhandler_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c09462

Please sign in to comment.