15 #ifndef _SigHandlersList_h
16 #define _SigHandlersList_h
21 #include <sys/types.h>
72 bool operator () (
const key_type c1_,
const key_type c2_)
const
81 typedef set< key_type, CompSHL >
set_t;
82 typedef set< key_type, CompSHL >::iterator
iterator;
101 bool insert (data_type data_);
105 void erase (
const key_type key_);
110 void erase (iterator it_);
127 iterator
find (
const key_type key_);
183 : m_seen_cfh (false), m_cfhp (NULL)
207 DL((
APP,
"m_instance[%d] = 0x%x\n", signum_,
211 DL((
APP,
"new SigHandlersList allocated\n"));
225 return m_set->empty ();
236 return m_set->size ();
258 set_t::const_iterator it =
m_set->find (eh_);
261 if (it ==
m_set->end ()) {
262 return (
m_set->insert (eh_)).second;
304 return m_set->begin ();
313 return m_set->end ();
322 return m_set->find (key_);
372 : m_c_sig_hand (csigh_)
384 (*m_c_sig_hand)(signum_);
389 #endif // !defined(WIN32)
set< key_type, CompSHL >::iterator iterator
bool operator()(const key_type c1_, const key_type c2_) const
bool seen_cfunc_handler() const
void erase()
Empty event handlers' list.
static SigHandlersList * instance(int signum_)
Retrieve a pointer to the list of event handlers listening to signum_ signal delivery.
C_SIG_HANDLER m_c_sig_hand
iterator begin()
Return an iterator pointing to the beginning of the list.
int m_seen_cfh
If true this flag indicates that 3rd party event handler has already been installed prior taking cont...
iterator find(const key_type key_)
Find event handler by its pointer key_.
int handle_signal(int signum_)
Signal handler callback.
Application-level messages.
CFUNC_Handler * m_cfhp
Pointer to the 3rd party signal handler in the set.
iterator end()
Return an iterator pointing to the end of the list.
#define DL(X)
A macro for writing debug message to the Logger.
CFUNC_Handler(C_SIG_HANDLER csigh_)
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
set< key_type, CompSHL > set_t
static SigHandlersList * m_instance[NSIG]
Static map of signal numbers to SigHandlerLists.
bool empty() const
Is list empty.
size_t size() const
Size of the list.
Class SigHandler(s) messages.
SigHandlersList & operator=(const SigHandlersList &map_)
bool insert(data_type data_)
Add an event handler data_ to the list.
Class SigHandler is a UNIX signal handlers manager/dispatcher class.
set_t * m_set
Set of all event handlers registered for this signal.
~SigHandlersList()
Destructor.
void(* C_SIG_HANDLER)(int)
CFUNC_Handler * cfunc_handler() const
Retrieve pointer to 3rd party C function handler.