diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-03-31 16:17:09 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-03-31 16:28:25 +0200 |
commit | f96d2cbebc2888eab320a81cc05129e622568e92 (patch) | |
tree | d086fdc983ea82a0234755d59a65cfc7f4414b00 /vespalib | |
parent | 451173e78f50c4db14f0def7a12eb9881720b94a (diff) |
Block SIGTERM on application shutdown.
This closes a window where SIGTERM will immediate terminate the program,
possibly causing valgrind errors.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/signalhandler.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/util/signalhandler.cpp b/vespalib/src/vespa/vespalib/util/signalhandler.cpp index 21543ef10d8..39bb5c1a1d4 100644 --- a/vespalib/src/vespa/vespalib/util/signalhandler.cpp +++ b/vespalib/src/vespa/vespalib/util/signalhandler.cpp @@ -108,6 +108,11 @@ SignalHandler::unhook() void SignalHandler::shutdown() { + // Block SIGTERM at shutdown in case valgrind is used. + sigset_t signals_to_block; + sigemptyset(&signals_to_block); + sigaddset(&signals_to_block, SIGTERM); + sigprocmask(SIG_BLOCK, &signals_to_block, nullptr); for (std::vector<SignalHandler*>::iterator it = _handlers.begin(), ite = _handlers.end(); it != ite; |