#include <WorkerMonitorThread.h>
Definition at line 32 of file WorkerMonitorThread.h.
edm::shared_memory::WorkerMonitorThread::WorkerMonitorThread |
( |
| ) |
|
|
inline |
edm::shared_memory::WorkerMonitorThread::~WorkerMonitorThread |
( |
| ) |
|
|
inline |
void WorkerMonitorThread::run |
( |
| ) |
|
|
private |
Definition at line 41 of file WorkerMonitorThread.cc.
References action_, actionSet_, MessageLogger_cfi::cerr, helperReady_, s_helperThreadDone, and s_pipeReadEnd.
Referenced by setAction(), and startThread().
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";
std::atomic< bool > helperReady_
static std::atomic< bool > s_helperThreadDone
std::atomic< bool > actionSet_
static std::atomic< int > s_pipeReadEnd
std::function< void()> action_
void edm::shared_memory::WorkerMonitorThread::setAction |
( |
std::function< void()> |
iFunc | ) |
|
|
inline |
void WorkerMonitorThread::setupSignalHandling |
( |
| ) |
|
Sets the unix signal handler which communicates with the thread.
Definition at line 102 of file WorkerMonitorThread.cc.
References sig_handler().
Referenced by main(), setAction(), and startThread().
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);
static void sig_handler(int sig, siginfo_t *, void *)
void WorkerMonitorThread::sig_handler |
( |
int |
sig, |
|
|
siginfo_t * |
, |
|
|
void * |
|
|
) |
| |
|
staticprivate |
void WorkerMonitorThread::startThread |
( |
| ) |
|
Definition at line 78 of file WorkerMonitorThread.cc.
References helperReady_, helperThread_, eostools::move(), pipe::pipe(), run(), s_pipeReadEnd, s_pipeWriteEnd, setupSignalHandling(), and protons_cff::t.
Referenced by main(), and setAction().
82 int pipeEnds[2] = {0, 0};
83 auto ret =
pipe(pipeEnds);
static std::atomic< int > s_pipeWriteEnd
std::thread helperThread_
std::atomic< bool > helperReady_
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
def pipe(cmdline, input=None)
static std::atomic< int > s_pipeReadEnd
void WorkerMonitorThread::stop |
( |
| ) |
|
std::function<void()> edm::shared_memory::WorkerMonitorThread::action_ |
|
private |
std::atomic<bool> edm::shared_memory::WorkerMonitorThread::actionSet_ = false |
|
private |
std::atomic<bool> edm::shared_memory::WorkerMonitorThread::helperReady_ = false |
|
private |
std::thread edm::shared_memory::WorkerMonitorThread::helperThread_ |
|
private |
std::atomic< bool > WorkerMonitorThread::s_helperThreadDone = false |
|
staticprivate |
std::atomic< int > WorkerMonitorThread::s_pipeReadEnd = 0 |
|
staticprivate |
std::atomic< int > WorkerMonitorThread::s_pipeWriteEnd = 0 |
|
staticprivate |
std::atomic<bool> edm::shared_memory::WorkerMonitorThread::stopRequested_ = false |
|
private |