Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Sig_Handlers Class Reference

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. More...

#include <Signal.h>

Inheritance diagram for ACE_Sig_Handlers:

Inheritance graph
[legend]
Collaboration diagram for ACE_Sig_Handlers:

Collaboration graph
[legend]
List of all members.

Public 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>. More...

virtual int remove_handler (int signum, ACE_Sig_Action *new_disp=0, ACE_Sig_Action *old_disp=0, int sigkey=-1)
 Remove an <ACE_Event_Handler> currently associated with <signum>. More...

virtual ACE_Event_Handlerhandler (int signum)
 Return the head of the list of <ACE_Sig_Handler>s associated with SIGNUM. More...

virtual ACE_Event_Handlerhandler (int signum, ACE_Event_Handler *)
 Set a new <ACE_Event_Handler> that is associated with SIGNUM at the head of the list of signals. More...

void dump (void) const
 Dump the state of an object. More...


Static Public Methods

void dispatch (int signum, siginfo_t *, ucontext_t *)
 Callback routine registered with sigaction(2) that dispatches the <handle_signal> method of all the pre-registered ACE_Event_Handlers for <signum>. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Static Private Attributes

int sigkey_ = 0
 Keeps track of the id that uniquely identifies each registered signal handler. More...

int third_party_sig_handler_ = 0
 If this is > 0 then a 3rd party library has registered a handler... More...


Detailed Description

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.

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.


Member Function Documentation

void ACE_Sig_Handlers::dispatch int    signum,
siginfo_t   siginfo,
ucontext_t   ucontext
[static]
 

Callback routine registered with sigaction(2) that dispatches the <handle_signal> method of all the pre-registered ACE_Event_Handlers for <signum>.

Reimplemented from ACE_Sig_Handler.

void ACE_Sig_Handlers::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Sig_Handler.

ACE_Event_Handler * ACE_Sig_Handlers::handler int    signum,
ACE_Event_Handler   new_sh
[virtual]
 

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.

Reimplemented from ACE_Sig_Handler.

ACE_Event_Handler * ACE_Sig_Handlers::handler int    signum [virtual]
 

Return the head of the list of <ACE_Sig_Handler>s associated with SIGNUM.

Reimplemented from ACE_Sig_Handler.

int ACE_Sig_Handlers::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]
 

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.

Reimplemented from ACE_Sig_Handler.

int ACE_Sig_Handlers::remove_handler int    signum,
ACE_Sig_Action   new_disp = 0,
ACE_Sig_Action   old_disp = 0,
int    sigkey = -1
[virtual]
 

Remove an <ACE_Event_Handler> currently associated with <signum>.

We remove the handler if (1) its <sigkey> matches the <sigkey> passed as a parameter or (2) if we've been told to remove all the handlers, i.e., <sigkey> == -1. If a new disposition is given it is installed and the previous disposition is returned (if desired by the caller). Returns 0 on success and -1 if <signum> is invalid.

Reimplemented from ACE_Sig_Handler.


Member Data Documentation

ACE_Sig_Handlers::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Sig_Handler.

int ACE_Sig_Handlers::sigkey_ = 0 [static, private]
 

Keeps track of the id that uniquely identifies each registered signal handler.

This id can be used to cancel a timer via the <remove_handler> method.

int ACE_Sig_Handlers::third_party_sig_handler_ = 0 [static, private]
 

If this is > 0 then a 3rd party library has registered a handler...


The documentation for this class was generated from the following files:
Generated on Thu Oct 10 17:12:17 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001