45 sigemptyset(&ensemble);
46 sigaddset(&ensemble, SIGABRT);
47 sigaddset(&ensemble, SIGILL);
48 sigaddset(&ensemble, SIGBUS);
49 sigaddset(&ensemble, SIGSEGV);
50 sigaddset(&ensemble, SIGTERM);
51 pthread_sigmask(SIG_BLOCK, &ensemble,
nullptr);
57 auto res = read(
s_pipeReadEnd.load(), &signal,
sizeof(signal) /
sizeof(
char));
68 std::cerr <<
"Worker: SIGNAL CAUGHT " << signal <<
"\n";
82 int pipeEnds[2] = {0, 0};
83 auto ret =
pipe(pipeEnds);
103 struct sigaction act;
105 act.sa_flags = SA_SIGINFO;
106 sigemptyset(&act.sa_mask);
107 sigaction(SIGABRT, &act,
nullptr);
108 sigaction(SIGILL, &act,
nullptr);
109 sigaction(SIGBUS, &act,
nullptr);
110 sigaction(SIGSEGV, &act,
nullptr);
111 sigaction(SIGTERM, &act,
nullptr);
131 signal(sig, SIG_DFL);
static std::atomic< int > s_pipeWriteEnd
std::thread helperThread_
std::atomic< bool > helperReady_
static std::atomic< bool > s_helperThreadDone
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
std::atomic< bool > stopRequested_
static void sig_handler(int sig, siginfo_t *, void *)
def pipe(cmdline, input=None)
std::atomic< bool > actionSet_
static std::atomic< int > s_pipeReadEnd
std::function< void()> action_