Scarab  v2.4.6
Project 8 C++ Utility Library
signal_handler.hh
Go to the documentation of this file.
1 /*
2  * signal_handler.hh
3  *
4  * Created on: Dec 3, 2013
5  * Author: N.S. Oblath
6  */
7 
8 #ifndef SCARAB_SIGNAL_HANDLER_HH_
9 #define SCARAB_SIGNAL_HANDLER_HH_
10 
11 #include "scarab_api.hh"
12 
13 #include <memory>
14 #include <mutex>
15 #include <set>
16 
17 namespace scarab
18 {
19  class cancelable;
20 
22  {
23  public:
25  virtual ~signal_handler();
26 
27  void add_cancelable( cancelable* a_cancelable );
28  void remove_cancelable( cancelable* a_cancelable );
29 
30  void reset();
31 
32  static bool got_exit_signal();
33 
34  static void handler_cancel_threads( int _ignored );
35 
36  private:
37  static void print_message();
38 
39  typedef std::set< cancelable* > cancelers;
40  typedef cancelers::const_iterator cancelers_cit_t;
41  typedef cancelers::iterator cancelers_it_t;
42 
43  static cancelers f_cancelers;
44  static std::mutex f_mutex;
45 
46  static bool f_got_exit_signal;
47 
48  static bool f_handling_sig_quit;
49  static bool f_handling_sig_int;
50 
51  };
52 
53 } /* namespace scarab */
54 #endif /* SCARAB_SIGNAL_HANDLER_HH_ */
static bool f_handling_sig_int
cancelers::iterator cancelers_it_t
cancelers::const_iterator cancelers_cit_t
#define SCARAB_API
Definition: scarab_api.hh:24
static bool f_got_exit_signal
static std::mutex f_mutex
static bool f_handling_sig_quit
static cancelers f_cancelers
std::set< cancelable *> cancelers