From d6309672bf2d3c7f18cbc79bc805c12c18b741a0 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:09:12 +0200 Subject: [PATCH] Added sigterm to the signal handler for Benchmark --- src/cltools/Benchmark.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cltools/Benchmark.cpp b/src/cltools/Benchmark.cpp index 746d685683..2415381123 100644 --- a/src/cltools/Benchmark.cpp +++ b/src/cltools/Benchmark.cpp @@ -195,7 +195,11 @@ class SignalHandlerGuard { extern "C" void signalHandler(int signal) { if (signal == SIGINT) { signalReceived.store(true); - fprintf(stderr, "Signal handler called\n"); + fprintf(stderr, "Signal interrupt received\n"); + } + if (signal == SIGTERM) { + signalReceived.store(true); + fprintf(stderr, "Signal termination received\n"); } } @@ -689,6 +693,7 @@ int Benchmark::main(FILE* in, FILE*out,Communicator& pc) { log<<"Use CTRL+C to stop at any time and collect timers (not working in MPI runs)\n"; // trap signals: SignalHandlerGuard sigIntGuard(SIGINT, signalHandler); + SignalHandlerGuard sigTermGuard(SIGTERM, signalHandler); for(int step=0; nf<0 || step