diff --git a/RTCP/Cobalt/InputProc/src/OMPThread.h b/RTCP/Cobalt/InputProc/src/OMPThread.h index 5877d1da78c4a43f03d342aa0be8726ab0ef4c0b..067628eea92aba6e39a3cb9afb6f3703ecbdb676 100644 --- a/RTCP/Cobalt/InputProc/src/OMPThread.h +++ b/RTCP/Cobalt/InputProc/src/OMPThread.h @@ -71,9 +71,8 @@ namespace LOFAR void kill() { while (!stopped) { - // Interrupt blocking system calls (most notably, read()), - // possibly multiple in a row. - // Note that the thread will stick around until the end + // interrupt blocking system calls (most notably, read()) + // note that the thread will stick around until the end // of pragma parallel, so the thread id is always valid // once it has been set. pthread_t oldid = id; @@ -113,16 +112,8 @@ namespace LOFAR static void init() { - // We avoid cancellation exception for OpenMP threads. - // Allow signalling them ourselves to cancel blocking syscalls. - struct sigaction sa; - sa.sa_handler = sighandler; - ::sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; - int err = ::sigaction(SIGHUP, &sa, NULL); - if (err != 0) { - LOG_WARN("Failed to register a handler for SIGHUP: OpenMP threads may not terminate!"); - } + signal(SIGHUP, sighandler); + siginterrupt(SIGHUP, 1); } private: