Skip to content
Snippets Groups Projects
Commit d4aa7d1f authored by Alexander van Amesfoort's avatar Alexander van Amesfoort
Browse files

Task #5395: re-commit signal()/siginterrupt() patch to replace them with...

Task #5395: re-commit signal()/siginterrupt() patch to replace them with sigaction(), now without SA_RESTART flag (duh). tMPITransfer is not broken by this patch version.
parent 79b52781
No related branches found
No related tags found
No related merge requests found
...@@ -71,8 +71,9 @@ namespace LOFAR ...@@ -71,8 +71,9 @@ namespace LOFAR
void kill() void kill()
{ {
while (!stopped) { while (!stopped) {
// interrupt blocking system calls (most notably, read()) // Interrupt blocking system calls (most notably, read()),
// note that the thread will stick around until the end // possibly multiple in a row.
// Note that the thread will stick around until the end
// of pragma parallel, so the thread id is always valid // of pragma parallel, so the thread id is always valid
// once it has been set. // once it has been set.
pthread_t oldid = id; pthread_t oldid = id;
...@@ -112,8 +113,16 @@ namespace LOFAR ...@@ -112,8 +113,16 @@ namespace LOFAR
static void init() static void init()
{ {
signal(SIGHUP, sighandler); // We avoid cancellation exception for OpenMP threads.
siginterrupt(SIGHUP, 1); // Allow signalling them ourselves to interrupt some blocking syscalls.
struct sigaction sa;
sa.sa_handler = sighandler;
::sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
int err = ::sigaction(SIGHUP, &sa, NULL);
if (err != 0) {
LOG_WARN("Failed to register a handler for SIGHUP: OpenMP threads may not terminate!");
}
} }
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment