diff options
Diffstat (limited to 'vespalib/src/tests/signalhandler/victim.cpp')
-rw-r--r-- | vespalib/src/tests/signalhandler/victim.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vespalib/src/tests/signalhandler/victim.cpp b/vespalib/src/tests/signalhandler/victim.cpp new file mode 100644 index 00000000000..fe42489006c --- /dev/null +++ b/vespalib/src/tests/signalhandler/victim.cpp @@ -0,0 +1,21 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/vespalib/util/signalhandler.h> + +using vespalib::SignalHandler; + +int main(int argc, char **argv) { + (void) argc; + (void) argv; + SignalHandler::TERM.hook(); + kill(getpid(), SIGTERM); + if (SignalHandler::TERM.check()) { + fprintf(stdout, "GOT TERM\n"); + fflush(stdout); + } + SignalHandler::TERM.unhook(); + kill(getpid(), SIGTERM); + fprintf(stdout, "SURVIVED TERM\n"); + fflush(stdout); + return 0; +} |