NAME
ACE_Sig_Handlers -
This is an alternative signal handling dispatcher for ACE. It
allows a list of signal handlers to be registered for each
signal. It also makes SA_RESTART the default mode.
SYNOPSIS
#include <ace/Signal.h>
class ACE_Sig_Handlers : public ACE_Sig_Handler
{
public:
virtual int register_handler (
int signum,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0
);
virtual int remove_handler (
int signum,
ACE_Sig_Action *new_disp = 0,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1
);
virtual ACE_Event_Handler *handler (int signum);
virtual ACE_Event_Handler *handler (
int signum,
ACE_Event_Handler *
);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
static void dispatch (int signum , siginfo_t *, ucontext_t * );
static int sigkey_;
static int third_party_sig_handler_;
};
DESCRIPTION
Using this class a program can register one or more
ACE_Event_Handler with the ACE_Sig_Handler in order to
handle a designated signum. When a signal occurs that
corresponds to this signum, the handle_signal methods of
all the registered ACE_Event_Handlers are invoked
automatically.
Registration and removal methods.
virtual int register_handler (
int signum,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0
);
Add a new ACE_Event_Handler and a new sigaction associated with
signum. Passes back the existing ACE_Event_Handler and its
sigaction if pointers are non-zero. Returns -1 on failure and
a sigkey that is = 0 on success.
virtual int remove_handler (
int signum,
ACE_Sig_Action *new_disp = 0,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1
);
Remove the ACE_Event_Handler currently associated with signum.
Install the new disposition (if given) and return the previous
disposition (if desired by the caller). Returns 0 on success and
-1 if signum is invalid.
Set/get the handler associated with a particular signal.
virtual ACE_Event_Handler *handler (int signum);
Return the head of the list of ACE_Sig_Handlers associated
with SIGNUM.
virtual ACE_Event_Handler *handler (int signum, ACE_Event_Handler *);
Set a new ACE_Event_Handler that is associated with SIGNUM at the
head of the list of signals. Return the existing handler that
was at the head.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
AUTHOR
Doug Schmidt
LIBRARY
ace