30 DL((
SIGHAND,
"==> Received signal # %d\n", signum_));
54 EL((
ASSAERR,
"in_range (%s) failed\n",signum_));
84 DL((
SIGHAND,
"Detected 3rd party \"C\" handler!\n"));
93 DL((
SIGHAND,
"Adding 3rd party \"C\" handler\n"));
95 if ( handlist->
insert (cfhp) ==
false ) {
97 "c_func_handler for signum %d\n", signum_));
106 DL((
SIGHAND,
"Adding EventHandler to the list\n"));
108 if (handlist->
insert (new_hand_) ==
false) {
114 EL((
ASSAERR,
"failed to add new_hand_ to handlers list\n"));
117 handlist->
size() == 1)
131 DL((
SIGHAND,
"Installing 'sighandlers_dispatcher'\n"));
139 if (new_disp_ == 0) {
152 EL((
ASSAERR,
"register_action() error\n"));
159 handlist->
erase (new_hand_);
174 EL((
ASSAERR,
"singum_ %d is out of range\n", signum_));
184 DL((
SIGHAND,
"Erasing the entire set\n"));
206 if ((it = handlist.
find (eh_)) != handlist.
end ()) {
214 if (handlist.
size ())
return 0;
220 if (new_disp_ == 0) new_disp_ = &null_sa;
222 DL((
SIGHAND,
"Handlers List is empty\n"));
226 DL((
SIGHAND,
"Reinstalling \"C\" handler\n"));
247 int errno_saved = errno;
253 for (it=handlist.
begin(); it != handlist.
end(); it++) {
#define EL(X)
A macro for writing error message to the Logger.
#define DL(X)
A macro for writing debug message to the Logger.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
void(* C_SIG_HANDLER)(int)
SigHandlers is a signal handlers manager.
virtual int handle_signal(int signum_)
Signal handler callback.
void handler(C_SIG_HANDLER sha_)
Set new signal handler to function pointer sha_.
int retrieve_action(int signum_)
Retrieve current disposition for the signal signum_ into this object.
int register_action(int signum_, SigAction *oaction_=0)
Register this object as current disposition for signal signum_, and store old disposition in oaction_...
int in_range(int signum_)
Check that signum_ is in valid range.
set< key_type, CompSHL >::iterator iterator
static SigHandlersList * m_instance[NSIG]
Static map of signal numbers to SigHandlerLists.
iterator find(const key_type key_)
Find event handler by its pointer key_.
iterator begin()
Return an iterator pointing to the beginning of the list.
bool insert(data_type data_)
Add an event handler data_ to the list.
void erase(const key_type key_)
Find and remove event handler key_ from the list.
iterator end()
Return an iterator pointing to the end of the list.
CFUNC_Handler * cfunc_handler(CFUNC_Handler *cfp_)
Save 3rd party C function handler to remember.
size_t size() const
Size of the list.
static SigHandlersList * instance(int signum_)
Retrieve a pointer to the list of event handlers listening to signum_ signal delivery.
void seen_cfunc_handler(bool ft_)
Indicate whether 3rd party C function handler was installed.
static void sighandlers_dispatcher(int signum_)
A wrapper around static SigHandlers::dispatch().
virtual int remove(int signum_, EventHandler *eh_, SigAction *new_disp_=0, SigAction *old_disp_=0)
Remove EventHandler from the list of registered handler for signum_.
virtual int install(int signum_, EventHandler *new_hand_, SigAction *new_disp_=0, EventHandler **old_hand_=0, SigAction *old_disp_=0)
Register EventHandler with dispatching system.
static void dispatch(int signum_)
The heart of SigHandlers class - this callback function is really registered with OS to catch all of ...
@ SIGHAND
Class SigHandler(s) messages
@ ASSAERR
ASSA and system errors