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

ACE_Sig_Action Class Reference

C++ wrapper facade for the <sigaction> struct. More...

#include <Signal.h>

List of all members.

Public Methods

 ACE_Sig_Action (void)
 Default constructor. Initializes everything to 0. More...

 ACE_Sig_Action (ACE_SignalHandler handler, sigset_t *sigmask=0, int flags=0)
 Assigns the various fields of a <sigaction> struct but doesn't register for signal handling via the <sigaction> function. More...

 ACE_Sig_Action (ACE_SignalHandler handler, const ACE_Sig_Set &sigmask, int flags=0)
 Assigns the various fields of a <sigaction> struct but doesn't register for signal handling via the <sigaction> function. More...

 ACE_Sig_Action (ACE_SignalHandler handler, int signum, sigset_t *sigmask=0, int flags=0)
 ACE_Sig_Action (ACE_SignalHandler handler, int signum, const ACE_Sig_Set &sigmask, int flags=0)
 ACE_Sig_Action (const ACE_Sig_Set &signalss, ACE_SignalHandler handler, const ACE_Sig_Set &sigmask, int flags=0)
 ACE_Sig_Action (const ACE_Sig_Set &signalss, ACE_SignalHandler handler, sigset_t *sigmask=0, int flags=0)
 ACE_Sig_Action (const ACE_Sig_Action &s)
 Copy constructor. More...

 ~ACE_Sig_Action (void)
 Default dtor. More...

int register_action (int signum, ACE_Sig_Action *oaction=0)
 Register <this> as the current disposition and store old disposition into <oaction> if it is non-NULL. More...

int restore_action (int signum, ACE_Sig_Action &oaction)
 Assign the value of <oaction> to <this> and make it become the new signal disposition. More...

int retrieve_action (int signum)
 Retrieve the current disposition into <this>. More...

void set (struct sigaction *)
 Set current signal action. More...

sigaction * get (void)
 Get current signal action. More...

 operator ACE_SIGACTION * ()
void flags (int)
 Set current signal flags. More...

int flags (void)
 Get current signal flags. More...

void mask (sigset_t *)
 Set current signal mask. More...

void mask (ACE_Sig_Set &)
sigset_t * mask (void)
 Get current signal mask. More...

void handler (ACE_SignalHandler)
 Set current signal handler (pointer to function). More...

ACE_SignalHandler handler (void)
 Get current signal handler (pointer to function). More...

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

sigaction sa_
 Controls signal behavior. More...


Detailed Description

C++ wrapper facade for the <sigaction> struct.

Definition at line 96 of file Signal.h.


Constructor & Destructor Documentation

ACE_Sig_Action::ACE_Sig_Action void   
 

Default constructor. Initializes everything to 0.

Definition at line 78 of file Signal.cpp.

References sa_, and ACE_OS::sigemptyset.

00079 {
00080   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00081   this->sa_.sa_flags = 0;
00082 
00083   // Since Service_Config::signal_handler_ is static and has an
00084   // ACE_Sig_Action instance, Win32 will get errno set unless this is
00085   // commented out.
00086 #if !defined (ACE_WIN32)
00087   ACE_OS::sigemptyset (&this->sa_.sa_mask);
00088 #endif /* ACE_WIN32 */
00089   this->sa_.sa_handler = 0;
00090 }

ACE_Sig_Action::ACE_Sig_Action ACE_SignalHandler    handler,
sigset_t *    sigmask = 0,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct but doesn't register for signal handling via the <sigaction> function.

Definition at line 92 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, sa_, and ACE_OS::sigemptyset.

00095 {
00096   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00097   this->sa_.sa_flags = sig_flags;
00098 
00099   if (sig_mask == 0)
00100     ACE_OS::sigemptyset (&this->sa_.sa_mask);
00101   else
00102     this->sa_.sa_mask = *sig_mask; // Structure assignment...
00103 
00104 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00105   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00106 #else
00107   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00108 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00109 }

ACE_Sig_Action::ACE_Sig_Action ACE_SignalHandler    handler,
const ACE_Sig_Set   sigmask,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct but doesn't register for signal handling via the <sigaction> function.

Definition at line 111 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, sa_, and ACE_Sig_Set::sigset.

00114 {
00115   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00116   this->sa_.sa_flags = sig_flags;
00117 
00118   // Structure assignment...
00119   this->sa_.sa_mask = sig_mask.sigset ();
00120 
00121 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00122   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00123 #else
00124   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00125 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00126 }

ACE_Sig_Action::ACE_Sig_Action ACE_SignalHandler    handler,
int    signum,
sigset_t *    sigmask = 0,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct and registers the <handler> to process signal <signum> via the <sigaction> function.

Definition at line 128 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, sa_, ACE_OS::sigaction, and ACE_OS::sigemptyset.

00132 {
00133   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00134   this->sa_.sa_flags = sig_flags;
00135 
00136   if (sig_mask == 0)
00137     ACE_OS::sigemptyset (&this->sa_.sa_mask);
00138   else
00139     this->sa_.sa_mask = *sig_mask; // Structure assignment...
00140 
00141 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00142   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00143 #else
00144   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00145 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00146   ACE_OS::sigaction (signum, &this->sa_, 0);
00147 }

ACE_Sig_Action::ACE_Sig_Action ACE_SignalHandler    handler,
int    signum,
const ACE_Sig_Set   sigmask,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct and registers the <handler> to process signal <signum> via the <sigaction> function.

Definition at line 149 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, sa_, ACE_OS::sigaction, and ACE_Sig_Set::sigset.

00153 {
00154   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00155   this->sa_.sa_flags = sig_flags;
00156 
00157   // Structure assignment...
00158   this->sa_.sa_mask = sig_mask.sigset ();
00159 
00160 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00161   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00162 #else
00163   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00164 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00165   ACE_OS::sigaction (signum, &this->sa_, 0);
00166 }

ACE_Sig_Action::ACE_Sig_Action const ACE_Sig_Set   signalss,
ACE_SignalHandler    handler,
const ACE_Sig_Set   sigmask,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct and registers the <handler> to process all <signals> via the <sigaction> function.

Definition at line 168 of file Signal.cpp.

References ACE_NSIG, ACE_SignalHandler, ACE_SignalHandlerV, ACE_Sig_Set::is_member, sa_, ACE_OS::sigaction, and ACE_Sig_Set::sigset.

00172 {
00173   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00174   this->sa_.sa_flags = sig_flags;
00175 
00176   // Structure assignment...
00177   this->sa_.sa_mask = sig_mask.sigset ();
00178 
00179 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00180   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00181 #else
00182   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00183 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00184 
00185 #if (ACE_NSIG > 0)  &&  !defined (CHORUS)
00186   for (int s = 1; s < ACE_NSIG; s++)
00187     if (signals.is_member (s))
00188       ACE_OS::sigaction (s, &this->sa_, 0);
00189 #else  /* ACE_NSIG <= 0  ||  CHORUS */
00190   ACE_UNUSED_ARG (signals);
00191 #endif /* ACE_NSIG <= 0  ||  CHORUS */
00192 }

ACE_Sig_Action::ACE_Sig_Action const ACE_Sig_Set   signalss,
ACE_SignalHandler    handler,
sigset_t *    sigmask = 0,
int    flags = 0
 

Assigns the various fields of a <sigaction> struct and registers the <handler> to process all <signals> via the <sigaction> function.

Definition at line 194 of file Signal.cpp.

References ACE_NSIG, ACE_SignalHandler, ACE_SignalHandlerV, ACE_Sig_Set::is_member, sa_, ACE_OS::sigaction, and ACE_OS::sigemptyset.

00198 {
00199   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00200   this->sa_.sa_flags = sig_flags;
00201 
00202   if (sig_mask == 0)
00203     ACE_OS::sigemptyset (&this->sa_.sa_mask);
00204   else
00205     this->sa_.sa_mask = *sig_mask; // Structure assignment...
00206 
00207 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00208   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00209 #else
00210   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00211 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00212 
00213 #if (ACE_NSIG > 0)  &&  !defined (CHORUS)
00214   for (int s = 1; s < ACE_NSIG; s++)
00215     if (signals.is_member (s))
00216       ACE_OS::sigaction (s, &this->sa_, 0);
00217 #else  /* ACE_NSIG <= 0  ||  CHORUS */
00218   ACE_UNUSED_ARG (signals);
00219 #endif /* ACE_NSIG <= 0  ||  CHORUS */
00220 }

ACE_INLINE ACE_Sig_Action::ACE_Sig_Action const ACE_Sig_Action &    s
 

Copy constructor.

Definition at line 195 of file Signal.i.

References ACE_TRACE.

00196      : sa_ ()
00197 {
00198   ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00199   *this = s; // structure copy.
00200 }

ACE_INLINE ACE_Sig_Action::~ACE_Sig_Action void   
 

Default dtor.

Definition at line 98 of file Signal.i.

References ACE_TRACE.

00099 {
00100   ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action");
00101 }


Member Function Documentation

void ACE_Sig_Action::dump void    const
 

Dump the state of an object.

Definition at line 57 of file Signal.cpp.

References ACE_TRACE.

00058 {
00059   ACE_TRACE ("ACE_Sig_Action::dump");
00060 }

ACE_INLINE int ACE_Sig_Action::flags void   
 

Get current signal flags.

Definition at line 104 of file Signal.i.

References ACE_TRACE, and sa_.

00105 {
00106   ACE_TRACE ("ACE_Sig_Action::flags");
00107   return this->sa_.sa_flags;
00108 }

ACE_INLINE void ACE_Sig_Action::flags int   
 

Set current signal flags.

Definition at line 111 of file Signal.i.

References ACE_TRACE, flags, and sa_.

Referenced by flags, ACE_Sig_Handlers::register_handler, and ACE_Sig_Handler::register_handler_i.

00112 {
00113   ACE_TRACE ("ACE_Sig_Action::flags");
00114   this->sa_.sa_flags = flags;
00115 }

ACE_INLINE struct sigaction * ACE_Sig_Action::get void   
 

Get current signal action.

Definition at line 181 of file Signal.i.

References ACE_TRACE.

Referenced by restore_action.

00182 {
00183   ACE_TRACE ("ACE_Sig_Action::get");
00184   return &this->sa_;
00185 }

ACE_INLINE ACE_SignalHandler ACE_Sig_Action::handler void   
 

Get current signal handler (pointer to function).

Definition at line 140 of file Signal.i.

References ACE_SignalHandler, and ACE_TRACE.

00141 {
00142   ACE_TRACE ("ACE_Sig_Action::handler");
00143   return ACE_SignalHandler (this->sa_.sa_handler);
00144 }

ACE_INLINE void ACE_Sig_Action::handler ACE_SignalHandler   
 

Set current signal handler (pointer to function).

Definition at line 147 of file Signal.i.

References ACE_SignalHandler, ACE_SignalHandlerV, ACE_TRACE, handler, and sa_.

Referenced by handler, ACE_Sig_Handlers::register_handler, and ACE_Sig_Handler::register_handler_i.

00148 {
00149   ACE_TRACE ("ACE_Sig_Action::handler");
00150 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00151   this->sa_.sa_handler = ACE_SignalHandlerV (handler);
00152 #else
00153   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler);
00154 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00155 }

ACE_INLINE sigset_t * ACE_Sig_Action::mask void   
 

Get current signal mask.

Definition at line 118 of file Signal.i.

References ACE_TRACE, and sa_.

00119 {
00120   ACE_TRACE ("ACE_Sig_Action::mask");
00121   return &this->sa_.sa_mask;
00122 }

ACE_INLINE void ACE_Sig_Action::mask ACE_Sig_Set  
 

Definition at line 133 of file Signal.i.

References ACE_TRACE, sa_, and ACE_Sig_Set::sigset.

00134 {
00135   ACE_TRACE ("ACE_Sig_Action::mask");
00136   this->sa_.sa_mask = ss.sigset (); // Structure assignment
00137 }

ACE_INLINE void ACE_Sig_Action::mask sigset_t *   
 

Set current signal mask.

Definition at line 125 of file Signal.i.

References ACE_TRACE, and sa_.

00126 {
00127   ACE_TRACE ("ACE_Sig_Action::mask");
00128   if (ss != 0)
00129     this->sa_.sa_mask = *ss; // Structure assignment
00130 }

ACE_INLINE ACE_Sig_Action::operator ACE_SIGACTION *  
 

Definition at line 188 of file Signal.i.

References ACE_TRACE, and sa_.

00189 {
00190   ACE_TRACE ("ACE_Sig_Action::operator ACE_SIGACTION *");
00191   return &this->sa_;
00192 }

ACE_INLINE int ACE_Sig_Action::register_action int    signum,
ACE_Sig_Action *    oaction = 0
 

Register <this> as the current disposition and store old disposition into <oaction> if it is non-NULL.

Definition at line 203 of file Signal.i.

References ACE_TRACE, and ACE_OS::sigaction.

Referenced by ACE_Sig_Handler::dispatch, ACE_Sig_Adapter::handle_signal, ACE_Sig_Handlers::register_handler, ACE_Sig_Handler::register_handler_i, ACE_Sig_Handlers::remove_handler, ACE_Sig_Handler::remove_handler, ACE_Process_Manager::wait, and ACE_Process::wait.

00204 {
00205   ACE_TRACE ("ACE_Sig_Action::register_action");
00206   struct sigaction *sa = oaction == 0 ? 0 : oaction->get ();
00207 
00208   return ACE_OS::sigaction (signum, &this->sa_, sa);
00209 }

ACE_INLINE int ACE_Sig_Action::restore_action int    signum,
ACE_Sig_Action &    oaction
 

Assign the value of <oaction> to <this> and make it become the new signal disposition.

Definition at line 219 of file Signal.i.

References ACE_TRACE, get, sa_, and ACE_OS::sigaction.

00220 {
00221   ACE_TRACE ("ACE_Sig_Action::restore_action");
00222   this->sa_ = *oaction.get (); // Structure assignment
00223   return ACE_OS::sigaction (signum, &this->sa_, 0);
00224 }

ACE_INLINE int ACE_Sig_Action::retrieve_action int    signum
 

Retrieve the current disposition into <this>.

Definition at line 212 of file Signal.i.

References ACE_TRACE, and ACE_OS::sigaction.

Referenced by ACE_Sig_Handlers::register_handler.

00213 {
00214   ACE_TRACE ("ACE_Sig_Action::retrieve_action");
00215   return ACE_OS::sigaction (signum, 0, &this->sa_);
00216 }

ACE_INLINE void ACE_Sig_Action::set struct sigaction *   
 

Set current signal action.

Definition at line 174 of file Signal.i.

References ACE_TRACE, and sa_.

00175 {
00176   ACE_TRACE ("ACE_Sig_Action::set");
00177   this->sa_ = *sa; // Structure assignment.
00178 }


Member Data Documentation

ACE_Sig_Action::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 217 of file Signal.h.

struct sigaction ACE_Sig_Action::sa_ [private]
 

Controls signal behavior.

Definition at line 221 of file Signal.h.

Referenced by ACE_Sig_Action, flags, handler, mask, operator ACE_SIGACTION *, restore_action, and set.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:07 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002