LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
UnixSignalHandlers.h
Go to the documentation of this file.
1 #ifndef art_Utilities_UnixSignalHandlers_h
2 #define art_Utilities_UnixSignalHandlers_h
3 
4 /*----------------------------------------------------------------------
5 
6 UnixSignalHandlers: A set of little utility functions to establish
7 and manipulate Unix-style signal handling.
8 
9 ----------------------------------------------------------------------*/
10 
11 #include "art/Utilities/fwd.h"
12 
13 #include <atomic>
14 #include <csignal>
15 #include <mutex>
16 
17 namespace art {
18 
19  extern std::mutex usr2_lock;
20  extern std::atomic<int> shutdown_flag;
21 
22  extern "C" {
23  void ep_sigusr2(int, siginfo_t*, void*);
24  using CFUNC = void (*)(int, siginfo_t*, void*);
25  }
26 
27  int getSigNum();
28  void disableAllSigs(sigset_t* oldset);
29  void disableRTSigs();
30  void enableSignal(sigset_t* newset, int signum);
31  void disableSignal(sigset_t* newset, int signum);
32  void reenableSigs(sigset_t* oldset);
33  void installSig(int signum, CFUNC func);
34  void installCustomHandler(int signum, CFUNC func);
35  void sigInventory();
36 
37  void setupSignals(bool want_sigint_enabled);
38 
39 } // art
40 
41 #endif /* art_Utilities_UnixSignalHandlers_h */
42 
43 // Local Variables:
44 // mode: c++
45 // End:
std::atomic< int > shutdown_flag
void disableSignal(sigset_t *newset, const int signum)
void reenableSigs(sigset_t *oldset)
void sigInventory()
void disableRTSigs()
void disableAllSigs(sigset_t *oldset)
int getSigNum()
std::mutex usr2_lock
void setupSignals(bool want_sigint_enabled)
void ep_sigusr2(int which, siginfo_t *, void *)
HLT enums.
void(*)(int, siginfo_t *, void *) CFUNC
void installCustomHandler(const int signum, CFUNC func)
void enableSignal(sigset_t *newset, const int signum)
void installSig(const int signum, CFUNC func)