| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

SignalMonitorSvc.cpp
Go to the documentation of this file.
1 /*
2 * SignalMonitorSvc.cpp
3 *
4 * Created on: Apr 14, 2010
5 * Author: Marco Clemencic
6 */
7 #include "GaudiKernel/Service.h"
8 #include "GaudiUtils/ISignalMonitor.h"
9
10 #include <csignal>
11
12 #include <iostream>
13
14 namespace Gaudi {
15 namespace Utils {
26 class SignalMonitorSvc: public extends<Service,
27 Gaudi::ISignalMonitor> {
28 public:
29 #ifdef _WIN32
30 typedef void (__cdecl *handler_t)(int);
31 #else
32 typedef struct sigaction handler_t;
33 #endif
34
37 void monitorSignal(int signum, bool propagate) override {
38 if (!m_monitored[signum]) {
39 handler_t sa;
40 handler_t oldact;
41 #ifdef _WIN32
42 sa = SignalMonitorSvc::dispatcher;
43 oldact = signal(signum, sa);
44 #else
45 sa.sa_handler = SignalMonitorSvc::dispatcher;
46 sigemptyset(&sa.sa_mask);
47 sa.sa_flags = 0;
48 sigaction(signum, &sa, &oldact);
49 #endif
50 m_oldActions[signum] = oldact;
51 m_monitored[signum] = (propagate) ? SignalMonitorSvc::propagate
52 : SignalMonitorSvc::trap;
53 }
54 }
55
58 void ignoreSignal(int signum) override {
59 if (m_monitored[signum]) {
60 #ifdef _WIN32
61 (void) signal(signum, m_oldActions[signum]);
62 #else
63 sigaction(signum, &m_oldActions[signum], nullptr);
64 #endif
65 m_oldActions[signum] = m_defaultAction;
66 m_monitored[signum] = ignored;
67 }
68 }
69
71 bool gotSignal(int signum) const override {
72 return m_caught[signum] != 0;
73 }
74
76 void setSignal(int signum) override {
77 m_caught[signum] = 1;
78 }
79
81 void clearSignal(int signum) override {
82 m_caught[signum] = 0;
83 }
84
86 SignalMonitorSvc(const std::string& name, ISvcLocator* svcLoc): base_class(name, svcLoc) {
87 #ifdef _WIN32
88 m_defaultAction = SIG_DFL;
89 #else
90 m_defaultAction.sa_handler = SIG_DFL;
91 sigemptyset(&m_defaultAction.sa_mask);
92 m_defaultAction.sa_flags = 0;
93 #endif
94 for(int i = 0; i < NSIG; ++i){
95 m_caught[i] = 0;
96 m_monitored[i] = ignored;
97 m_oldActions[i] = m_defaultAction;
98 }
99
100 setInstance(this);
101 }
102
104 ~SignalMonitorSvc() override {
105 for (int i = 0; i < NSIG; ++i) ignoreSignal(i);
106 setInstance(nullptr);
107 }
108
109 private:
111 enum MonitoringMode {
112 ignored, //< the signal is not monitored
113 trap, //< the signal is monitored and not propagated to previously registered handlers
114 propagate //< the signal is monitored and propagated to previously registered handlers
115 };
117 MonitoringMode m_monitored[NSIG];
119 sig_atomic_t m_caught[NSIG];
121 handler_t m_defaultAction;
123 handler_t m_oldActions[NSIG];
124
125 void i_handle(int signum) {
126 m_caught[signum] = 1;
127 if ( m_monitored[signum] == propagate &&
128 #ifdef _WIN32
129 m_oldActions[signum] != SIG_DFL
130 #else
131 m_oldActions[signum].sa_handler != SIG_DFL
132 #endif
133 ) {
134 #ifdef _WIN32
135 m_oldActions[signum](signum);
136 #else
137 m_oldActions[signum].sa_handler(signum);
138 #endif
139 }
140 }
141
143 static SignalMonitorSvc *s_instance;
144
145 static inline void setInstance(SignalMonitorSvc *i) {
146 s_instance = i;
147 }
148
151 static inline SignalMonitorSvc *instance() {
152 return s_instance;
153 }
154
156 static void dispatcher(int signum);
157 };
158
159 // Implementation of the signal handler function.
160 void SignalMonitorSvc::dispatcher(int signum){
161 if (instance()) instance()->i_handle(signum);
162 }
163
164 } // namespace Utils
165 } // namespace Gaudi
166
167 #include <cctype>
168 #include <sstream>
169
170 #include <map>
171
172 #include "GaudiKernel/HashMap.h"
173
174 #include "GaudiKernel/IIncidentListener.h"
175 #include "GaudiKernel/IIncidentSvc.h"
176 #include "GaudiKernel/IEventProcessor.h"
177 #include "GaudiKernel/AppReturnCode.h"
178
179 namespace {
180 // hack because windows doesn't provide sys_siglist
181 const char *sig_desc(int signum) {
182 if (signum >= NSIG || signum < 0)
183 return nullptr;
184 #ifdef _WIN32
185 switch (signum) {
186 case SIGINT: return "Interrupt";
187 case SIGILL: return "Illegal instruction";
188 case SIGFPE: return "Floating point exception";
189 case SIGSEGV: return "Segmentation fault";
190 case SIGTERM: return "Terminated";
191 case SIGBREAK: return "Trace/breakpoint trap";
192 case SIGABRT: return "Aborted";
193 default: return 0;
194 }
195 #else
196 return sys_siglist[signum];
197 #endif
198 }
199
201 class SigMap {
202 public:
204 static const SigMap& instance() {
205 static SigMap _instance;
206 return _instance;
207 }
209 inline const std::string &name(int signum) const {
210 return m_num2id[signum];
211 }
213 inline const std::string &desc(int signum) const {
214 return m_num2desc[signum];
215 }
217 inline int signum(const std::string &str) const {
218 auto it = m_name2num.find(str);
219 return it != m_name2num.end() ? it->second : -1;
220 }
221 private:
224 SigMap(){
225 #define addSignal(id) i_addSignal(id, #id);
226 // List of signals from http://en.wikipedia.org/wiki/POSIX_signal
227 #ifdef SIGABRT
228 addSignal(SIGABRT); // Process aborted
229 #endif
230 #ifdef SIGALRM
231 addSignal(SIGALRM); // Signal raised by alarm
232 #endif
233 #ifdef SIGBUS
234 addSignal(SIGBUS); // Bus error: "access to undefined portion of memory object"
235 #endif
236 #ifdef SIGCHLD
237 addSignal(SIGCHLD); // Child process terminated, stopped (or continued*)
238 #endif
239 #ifdef SIGCONT
240 addSignal(SIGCONT); // Continue if stopped
241 #endif
242 #ifdef SIGFPE
243 addSignal(SIGFPE); // Floating point exception: "erroneous arithmetic operation"
244 #endif
245 #ifdef SIGHUP
246 addSignal(SIGHUP); // Hangup
247 #endif
248 #ifdef SIGILL
249 addSignal(SIGILL); // Illegal instruction
250 #endif
251 #ifdef SIGINT
252 addSignal(SIGINT); // Interrupt
253 #endif
254 #ifdef SIGKILL
255 addSignal(SIGKILL); // Kill (terminate immediately)
256 #endif
257 #ifdef SIGPIPE
258 addSignal(SIGPIPE); // Write to pipe with no one reading
259 #endif
260 #ifdef SIGQUIT
261 addSignal(SIGQUIT); // Quit and dump core
262 #endif
263 #ifdef SIGSEGV
264 addSignal(SIGSEGV); // Segmentation violation
265 #endif
266 #ifdef SIGSTOP
267 addSignal(SIGSTOP); // Stop executing temporarily
268 #endif
269 #ifdef SIGTERM
270 addSignal(SIGTERM); // Termination (request to terminate)
271 #endif
272 #ifdef SIGTSTP
273 addSignal(SIGTSTP); // Terminal stop signal
274 #endif
275 #ifdef SIGTTIN
276 addSignal(SIGTTIN); // Background process attempting to read from tty ("in")
277 #endif
278 #ifdef SIGTTOU
279 addSignal(SIGTTOU); // Background process attempting to write to tty ("out")
280 #endif
281 #ifdef SIGUSR1
282 addSignal(SIGUSR1); // User-defined 1
283 #endif
284 #ifdef SIGUSR2
285 addSignal(SIGUSR2); // User-defined 2
286 #endif
287 #ifdef SIGPOLL
288 addSignal(SIGPOLL); // Pollable event
289 #endif
290 #ifdef SIGPROF
291 addSignal(SIGPROF); // Profiling timer expired
292 #endif
293 #ifdef SIGSYS
294 addSignal(SIGSYS); // Bad syscall
295 #endif
296 #ifdef SIGTRAP
297 addSignal(SIGTRAP); // Trace/breakpoint trap
298 #endif
299 #ifdef SIGURG
300 addSignal(SIGURG); // Urgent data available on socket
301 #endif
302 #ifdef SIGVTALRM
303 addSignal(SIGVTALRM); // Signal raised by timer counting virtual time: "virtual timer expired"
304 #endif
305 #ifdef SIGXCPU
306 addSignal(SIGXCPU); // CPU time limit exceeded
307 #endif
308 #ifdef SIGXFSZ
309 addSignal(SIGXFSZ); // File size limit exceeded
310 #endif
311 #undef addSignal
312 }
314 inline void i_addSignal(int signum, const char *signame) {
315 m_num2id[signum] = signame;
316 m_name2num[signame] = signum;
317 const char* desc = sig_desc(signum);
318 if (desc) {
319 m_num2desc[signum] = desc;
320 m_name2num[desc] = signum;
321 }
322 }
323 GaudiUtils::HashMap<std::string, int> m_name2num; //< Map signal string id or description to number
324 GaudiUtils::HashMap<int, std::string> m_num2id; //< Map signal number to string id
325 GaudiUtils::HashMap<int, std::string> m_num2desc; //< Map signal number to description
326 };
327 }
328
329 namespace Gaudi {
330 namespace Utils {
340 class StopSignalHandler: public extends<Service,
341 IIncidentListener> {
342 public:
343 StopSignalHandler(const std::string& name, ISvcLocator* svcLoc): base_class(name, svcLoc) {
344 m_usedSignals.reserve(2);
345 m_usedSignals.push_back("SIGINT");
346 m_usedSignals.push_back("SIGXCPU");
347 m_stopRequested = false;
348 declareProperty("Signals", m_usedSignals,
349 "List of signal names or numbers to use to schedule a stop. "
350 "If the signal is followed by a '+' the signal is propagated the previously "
351 "registered handler (if any).");
352 }
353 StatusCode initialize() override {
354 StatusCode sc = Service::initialize();
355 if (sc.isFailure()) {
356 return sc;
357 }
358 std::string serviceName("Gaudi::Utils::SignalMonitorSvc");
359 m_signalMonitor = serviceLocator()->service(serviceName);
360 if ( ! m_signalMonitor ) {
361 error() << "Cannot retrieve " << serviceName << endmsg;
362 return StatusCode::FAILURE;
363 }
364 serviceName = "IncidentSvc";
365 m_incidentSvc = serviceLocator()->service(serviceName);
366 if ( ! m_incidentSvc ) {
367 error() << "Cannot retrieve " << serviceName << endmsg;
368 return StatusCode::FAILURE;
369 }
370 // Get the IMainAppStatus interface of the ApplicationMgr
371 m_appProperty = serviceLocator();
372 if ( ! m_appProperty ) {
373 warning() << "Cannot retrieve IProperty interface of ApplicationMgr, "
374 "the return code will not be changed" << endmsg;
375 }
376 // Decode the signal names
377 for (const auto& signame : m_usedSignals ) {
378 auto sigid = i_decodeSignal(signame);
379 if (sigid.first >= 0) {
380 m_signals[sigid.first] = sigid.second;
381 }
382 }
383 debug() << "Stopping on the signals:" << endmsg;
384 const SigMap& sigmap(SigMap::instance());
385 for (const auto& s : m_signals ) {
386 debug() << "\t" << sigmap.name(s.first) << ": "
387 << sigmap.desc(s.first) << " (" << s.first << ")";
388 if (s.second) debug() << " propagated";
389 debug() << endmsg;
390 // tell the signal monitor that we are interested in these signals
391 m_signalMonitor->monitorSignal(s.first, s.second);
392 }
393 m_stopRequested = false;
394 debug() << "Register to the IncidentSvc" << endmsg;
395 m_incidentSvc->addListener(this, IncidentType::BeginEvent);
396 return StatusCode::SUCCESS;
397 }
398 StatusCode finalize() override {
399 m_incidentSvc->removeListener(this, IncidentType::BeginEvent);
400 m_incidentSvc.reset();
401 // disable the monitoring of the signals
402 std::for_each( std::begin(m_signals), std::end(m_signals),
403 [&](const std::pair<int,bool>& s) {
404 // tell the signal monitor that we are interested in these signals
405 m_signalMonitor->ignoreSignal(s.first);
406 } );
407 m_signalMonitor.reset();
408 return Service::finalize();
409 }
410
411 void handle(const Incident&) override {
412 if (!m_stopRequested) {
413 const SigMap& sigmap(SigMap::instance());
414 for (const auto& s : m_signals ) {
415 if (!m_signalMonitor->gotSignal(s.first)) continue;
416 warning() << "Received signal '" << sigmap.name(s.first)
417 << "' (" << s.first;
418 const std::string &desc = sigmap.desc(s.first);
419 if ( ! desc.empty() ) warning() << ", " << desc;
420 warning() << ")" << endmsg;
421 m_stopRequested = true;
422 // Report the termination by signal at the end of the application
423 using Gaudi::ReturnCode::SignalOffset;
424 if (Gaudi::setAppReturnCode(m_appProperty, SignalOffset + s.first).isFailure()) {
425 error() << "Could not set return code of the application ("
426 << SignalOffset + s.first << ")"
427 << endmsg;
428 }
429
430 }
431 if (m_stopRequested) {
432 auto ep = serviceLocator()->as<IEventProcessor>();
433 if (ep) {
434 warning() << "Scheduling a stop" << endmsg;
435 ep->stopRun().ignore();
436 }
437 else {
438 warning() << "Cannot stop the processing because the IEventProcessor interface cannot be retrieved." << endmsg;
439 }
440 }
441 }
442 }
443 private:
445 std::vector<std::string> m_usedSignals;
447 std::map<int, bool> m_signals;
449 bool m_stopRequested;
451 SmartIF<Gaudi::ISignalMonitor> m_signalMonitor;
453 SmartIF<IIncidentSvc> m_incidentSvc;
455 SmartIF<IProperty> m_appProperty;
457 std::pair<int, bool> i_decodeSignal(const std::string &sig) {
458 debug() << "Decoding signal declaration '" << sig << "'" << endmsg;
459 if ( sig.empty() || sig == "+" ) {
460 debug() << "Empty signal, ignored" << endmsg;
461 return {-1, false}; // silently ignore empty strings
462 }
463 const SigMap& sigmap(SigMap::instance());
464 std::string signal = sig;
465 bool propagate = false;
466 // Check if the signal must be propagated
467 if (signal[signal.size() - 1] == '+') {
468 debug() << "Must be propagated to previously registered signal handlers" << endmsg;
469 propagate = true;
470 signal.erase(signal.size() - 1, 1); // remove the '+' at the end of the string
471 }
472 int signum = -1;
473 // check if the signal is a number
474 if (std::isdigit(signal[0])){
475 std::istringstream ss(signal);
476 ss >> signum;
477 } else {
478 // try to find the signal name in the list of known signals
479 signum = sigmap.signum(signal);
480 }
481 if (signum < 0) {
482 warning() << "Cannot understand signal identifier '" << sig << "', ignored" << endmsg;
483 } else {
484 verbose() << "Matched signal '" << sigmap.name(signum)
485 << "' (" << signum;
486 const std::string &desc = sigmap.desc(signum);
487 if ( ! desc.empty() ) {
488 verbose() << ", " << desc;
489 }
490 verbose() << ")" << endmsg;
491 }
492 return {signum, propagate};
493 }
494 };
495
496 } // namespace Utils
497 } // namespace Gaudi
498
499 // Initialization of static data member
500 Gaudi::Utils::SignalMonitorSvc* Gaudi::Utils::SignalMonitorSvc::s_instance = nullptr;
501
502 // ========================================================================
503 // Instantiation of a static factory class used by clients to create instances of this service
504 typedef Gaudi::Utils::SignalMonitorSvc g_u_sms;
505 DECLARE_COMPONENT(g_u_sms)
506
507 // Instantiation of a static factory class used by clients to create instances of this service
508 typedef Gaudi::Utils::StopSignalHandler g_u_ssh;
509 DECLARE_COMPONENT(g_u_ssh)
Gaudi::Utils::SignalMonitorSvc::setSignal
void setSignal(int signum) override
Set the flag for the given signal, as if the signal was received.
Definition: SignalMonitorSvc.cpp:76
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
Gaudi::Utils::SignalMonitorSvc::m_caught
sig_atomic_t m_caught[NSIG]
Array of flags for received signals.
Definition: SignalMonitorSvc.cpp:119
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
std::string::empty
T empty(T...args)
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
std::istringstream
STL class.
IEventProcessor.h
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
Gaudi::Utils::StopSignalHandler::m_stopRequested
bool m_stopRequested
Flag to remember if the stop has been requested because of a signal.
Definition: SignalMonitorSvc.cpp:449
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
Gaudi::Utils::StopSignalHandler::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Definition: SignalMonitorSvc.cpp:453
ep
int maxevt auto ep
Definition: Bootstrap.cpp:285
g_u_sms
Gaudi::Utils::SignalMonitorSvc g_u_sms
Definition: SignalMonitorSvc.cpp:504
Gaudi::Utils::SignalMonitorSvc::~SignalMonitorSvc
~SignalMonitorSvc() override
Stop monitoring signals and clear the instance pointer.
Definition: SignalMonitorSvc.cpp:104
Gaudi::Utils::SignalMonitorSvc::propagate
Definition: SignalMonitorSvc.cpp:114
Gaudi::Utils::SignalMonitorSvc::i_handle
void i_handle(int signum)
Definition: SignalMonitorSvc.cpp:125
Gaudi::Utils::SignalMonitorSvc::ignoreSignal
void ignoreSignal(int signum) override
Remove the specific signal handler for the requested signal, restoring the previous signal handler...
Definition: SignalMonitorSvc.cpp:58
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:130
Gaudi::Utils::SignalMonitorSvc::dispatcher
static void dispatcher(int signum)
Signal handler function.
Definition: SignalMonitorSvc.cpp:160
Gaudi::Utils::SignalMonitorSvc::clearSignal
void clearSignal(int signum) override
Clear the flag for the given signal, so that a new occurrence can be identified.
Definition: SignalMonitorSvc.cpp:81
std::end
T end(T...args)
ISvcLocator::as
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
ISignalMonitor.h
Gaudi::Utils::StopSignalHandler::finalize
StatusCode finalize() override
Definition: SignalMonitorSvc.cpp:398
HashMap.h
Gaudi::Utils::StopSignalHandler::m_signalMonitor
SmartIF< Gaudi::ISignalMonitor > m_signalMonitor
Pointer to the signal monitor service.
Definition: SignalMonitorSvc.cpp:451
merge_files.sc
int sc
Definition: merge_files.py:167
Gaudi::Utils::StopSignalHandler::m_usedSignals
std::vector< std::string > m_usedSignals
List of signal names or numbers (encoded as strings) to use to schedule a stop.
Definition: SignalMonitorSvc.cpp:445
std::map< int, bool >
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
Gaudi::Utils::SignalMonitorSvc::ignored
Definition: SignalMonitorSvc.cpp:112
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
std::string
STL class.
Service.h
Gaudi::Utils::SignalMonitorSvc::MonitoringMode
MonitoringMode
Possible monitoring modes.
Definition: SignalMonitorSvc.cpp:111
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Gaudi::Utils::StopSignalHandler::m_signals
std::map< int, bool > m_signals
Map of monitored signal numbers to the flag telling if they have to be propagated or not...
Definition: SignalMonitorSvc.cpp:447
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
Gaudi::Utils::SignalMonitorSvc::setInstance
static void setInstance(SignalMonitorSvc *i)
Definition: SignalMonitorSvc.cpp:145
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::Utils::SignalMonitorSvc::instance
static SignalMonitorSvc * instance()
Method to get the singleton instance.
Definition: SignalMonitorSvc.cpp:151
Gaudi::Utils::SignalMonitorSvc
Implementation of Gaudi::ISignalMonitor.
Definition: SignalMonitorSvc.cpp:26
IIncidentSvc.h
std::isdigit
T isdigit(T...args)
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Utils::SignalMonitorSvc::SignalMonitorSvc
SignalMonitorSvc(const std::string &name, ISvcLocator *svcLoc)
Initialize internal variables of the service and set the instance pointer.
Definition: SignalMonitorSvc.cpp:86
Gaudi::Utils::StopSignalHandler::handle
void handle(const Incident &) override
Definition: SignalMonitorSvc.cpp:411
std::string::erase
T erase(T...args)
Gaudi::Utils::StopSignalHandler::m_appProperty
SmartIF< IProperty > m_appProperty
Pointer to the interface to set the return code of the application.
Definition: SignalMonitorSvc.cpp:455
Gaudi::Utils::StopSignalHandler::i_decodeSignal
std::pair< int, bool > i_decodeSignal(const std::string &sig)
Function to translate the signal name to the signal number.
Definition: SignalMonitorSvc.cpp:457
GaudiPluginService.cpluginsvc._instance
_instance
Definition: cpluginsvc.py:62
Gaudi::Utils::StopSignalHandler
Service that stop the processing if a signal is received.
Definition: SignalMonitorSvc.cpp:340
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:50
Gaudi::Utils::SignalMonitorSvc::s_instance
static SignalMonitorSvc * s_instance
Pointer to the current instance.
Definition: SignalMonitorSvc.cpp:143
std::pair
AppReturnCode.h
std::string::find
T find(T...args)
std::string::size
T size(T...args)
std::vector< std::string >
Gaudi::Utils::SignalMonitorSvc::monitorSignal
void monitorSignal(int signum, bool propagate) override
Declare a signal to be monitored.
Definition: SignalMonitorSvc.cpp:37
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
std::begin
T begin(T...args)
Gaudi::Utils::SignalMonitorSvc::gotSignal
bool gotSignal(int signum) const override
Check if the given signal has been received.
Definition: SignalMonitorSvc.cpp:71
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
Gaudi::Utils::StopSignalHandler::initialize
StatusCode initialize() override
Definition: SignalMonitorSvc.cpp:353
GaudiUtils::HashMap< std::string, int >
gaudirun.s
string s
Definition: gaudirun.py:245
CommonMessaging
Definition: CommonMessaging.h:58
IEventProcessor
The IEventProcessor is the interface to process events.
Definition: IEventProcessor.h:16
IIncidentListener.h
addSignal
#define addSignal(id)
Gaudi::Utils::StopSignalHandler::StopSignalHandler
StopSignalHandler(const std::string &name, ISvcLocator *svcLoc)
Definition: SignalMonitorSvc.cpp:343
Gaudi::Utils::SignalMonitorSvc::m_monitored
MonitoringMode m_monitored[NSIG]
Array of flags to keep track of monitored signals.
Definition: SignalMonitorSvc.cpp:117
Gaudi::ReturnCode::SignalOffset
constexpr int SignalOffset
Definition: AppReturnCode.h:34
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
Gaudi::Utils::SignalMonitorSvc::m_oldActions
handler_t m_oldActions[NSIG]
List of replaced signal actions (for the recovery when disable the monitoring).
Definition: SignalMonitorSvc.cpp:123
__cdecl
#define __cdecl
Definition: xtoa.h:2
IIncidentSvc::removeListener
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
Gaudi::Utils::SignalMonitorSvc::m_defaultAction
handler_t m_defaultAction
Helper variable for default signal action.
Definition: SignalMonitorSvc.cpp:121
Gaudi::Utils::SignalMonitorSvc::trap
Definition: SignalMonitorSvc.cpp:113
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
std::for_each
T for_each(T...args)
ana.i
list i
Definition: ana.py:128
g_u_ssh
Gaudi::Utils::StopSignalHandler g_u_ssh
Definition: SignalMonitorSvc.cpp:508
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::Utils::SignalMonitorSvc::handler_t
struct sigaction handler_t
Definition: SignalMonitorSvc.cpp:32
std::vector::reserve
T reserve(T...args)