ACE_Sig_Action Class Reference

C++ wrapper facade for the struct. More...

#include <Signal.h>

List of all members.

Public Member Functions

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

 ACE_Sig_Action (ACE_SignalHandler handler, sigset_t *sigmask=0, int flags=0)
 ACE_Sig_Action (ACE_SignalHandler handler, const ACE_Sig_Set &sigmask, int flags=0)
 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.

 ~ACE_Sig_Action (void)
 Default dtor.

int register_action (int signum, ACE_Sig_Action *oaction=0)
int restore_action (int signum, ACE_Sig_Action &oaction)
int retrieve_action (int signum)
 Retrieve the current disposition into .

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

sigaction * get (void)
 Get current signal action.

 operator struct sigaction * ()
void flags (int)
 Set current signal flags.

int flags (void)
 Get current signal flags.

void mask (sigset_t *)
 Set current signal mask.

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

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

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

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

sigaction sa_
 Controls signal behavior.


Detailed Description

C++ wrapper facade for the struct.

Definition at line 101 of file Signal.h.


Constructor & Destructor Documentation

ACE_Sig_Action::ACE_Sig_Action void   ) 
 

Default constructor. Initializes everything to 0.

Definition at line 118 of file Signal.cpp.

References ACE_OS::sigemptyset().

00119 {
00120   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00121   this->sa_.sa_flags = 0;
00122 
00123   // Since Service_Config::signal_handler_ is static and has an
00124   // ACE_Sig_Action instance, Win32 will get errno set unless this is
00125   // commented out.
00126 #if !defined (ACE_WIN32)
00127   ACE_OS::sigemptyset (&this->sa_.sa_mask);
00128 #endif /* ACE_WIN32 */
00129   this->sa_.sa_handler = 0;
00130 }

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

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

Definition at line 132 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, and ACE_OS::sigemptyset().

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

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

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

Definition at line 151 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, and ACE_Sig_Set::sigset().

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

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

Assigns the various fields of a struct and registers the to process signal via the function.

Definition at line 168 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, ACE_OS::sigaction(), and ACE_OS::sigemptyset().

00172 {
00173   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00174   this->sa_.sa_flags = sig_flags;
00175 
00176   if (sig_mask == 0)
00177     ACE_OS::sigemptyset (&this->sa_.sa_mask);
00178   else
00179     this->sa_.sa_mask = *sig_mask; // Structure assignment...
00180 
00181 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00182   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00183 #else
00184   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00185 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00186   ACE_OS::sigaction (signum, &this->sa_, 0);
00187 }

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 struct and registers the to process signal via the function.

Definition at line 189 of file Signal.cpp.

References ACE_SignalHandler, ACE_SignalHandlerV, ACE_OS::sigaction(), and ACE_Sig_Set::sigset().

00193 {
00194   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00195   this->sa_.sa_flags = sig_flags;
00196 
00197   // Structure assignment...
00198   this->sa_.sa_mask = sig_mask.sigset ();
00199 
00200 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00201   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00202 #else
00203   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00204 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00205   ACE_OS::sigaction (signum, &this->sa_, 0);
00206 }

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 struct and registers the to process all via the function.

Definition at line 208 of file Signal.cpp.

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

00212 {
00213   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00214   this->sa_.sa_flags = sig_flags;
00215 
00216   // Structure assignment...
00217   this->sa_.sa_mask = sig_mask.sigset ();
00218 
00219 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00220   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00221 #else
00222   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00223 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00224 
00225 #if (ACE_NSIG > 0)
00226   for (int s = 1; s < ACE_NSIG; s++)
00227     if ((signals.is_member (s)) == 1)
00228       ACE_OS::sigaction (s, &this->sa_, 0);
00229 #else  /* ACE_NSIG <= 0  */
00230   ACE_UNUSED_ARG (signals);
00231 #endif /* ACE_NSIG <= 0  */
00232 }

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 struct and registers the to process all via the function.

Definition at line 234 of file Signal.cpp.

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

00238 {
00239   // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00240   this->sa_.sa_flags = sig_flags;
00241 
00242   if (sig_mask == 0)
00243     ACE_OS::sigemptyset (&this->sa_.sa_mask);
00244   else
00245     this->sa_.sa_mask = *sig_mask; // Structure assignment...
00246 
00247 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00248   this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
00249 #else
00250   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
00251 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00252 
00253 #if (ACE_NSIG > 0)
00254   for (int s = 1; s < ACE_NSIG; s++)
00255     if ((signals.is_member (s)) == 1)
00256       ACE_OS::sigaction (s, &this->sa_, 0);
00257 #else  /* ACE_NSIG <= 0  */
00258   ACE_UNUSED_ARG (signals);
00259 #endif /* ACE_NSIG <= 0  */
00260 }

ACE_INLINE ACE_Sig_Action::ACE_Sig_Action const ACE_Sig_Action s  ) 
 

Copy constructor.

Definition at line 187 of file Signal.inl.

References ACE_TRACE.

00188      : sa_ ()
00189 {
00190   ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
00191   *this = s; // structure copy.
00192 }

ACE_Sig_Action::~ACE_Sig_Action void   ) 
 

Default dtor.

Definition at line 74 of file Signal.cpp.

References ACE_TRACE.

00075 {
00076   ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action");
00077 }


Member Function Documentation

void ACE_Sig_Action::dump void   )  const
 

Dump the state of an object.

Definition at line 59 of file Signal.cpp.

References ACE_TRACE.

00060 {
00061 #if defined (ACE_HAS_DUMP)
00062   ACE_TRACE ("ACE_Sig_Action::dump");
00063 #endif /* ACE_HAS_DUMP */
00064 }

ACE_INLINE int ACE_Sig_Action::flags void   ) 
 

Get current signal flags.

Definition at line 96 of file Signal.inl.

References ACE_TRACE.

00097 {
00098   ACE_TRACE ("ACE_Sig_Action::flags");
00099   return this->sa_.sa_flags;
00100 }

ACE_INLINE void ACE_Sig_Action::flags int   ) 
 

Set current signal flags.

Definition at line 103 of file Signal.inl.

References ACE_TRACE.

Referenced by ACE_Sig_Handlers::register_handler(), and ACE_Sig_Handler::register_handler_i().

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

ACE_INLINE struct sigaction * ACE_Sig_Action::get void   ) 
 

Get current signal action.

Definition at line 173 of file Signal.inl.

References ACE_TRACE.

Referenced by register_action(), and restore_action().

00174 {
00175   ACE_TRACE ("ACE_Sig_Action::get");
00176   return &this->sa_;
00177 }

ACE_INLINE ACE_SignalHandler ACE_Sig_Action::handler void   ) 
 

Get current signal handler (pointer to function).

Definition at line 132 of file Signal.inl.

References ACE_SignalHandler, and ACE_TRACE.

00133 {
00134   ACE_TRACE ("ACE_Sig_Action::handler");
00135   return ACE_SignalHandler (this->sa_.sa_handler);
00136 }

ACE_INLINE void ACE_Sig_Action::handler ACE_SignalHandler   ) 
 

Set current signal handler (pointer to function).

Definition at line 139 of file Signal.inl.

References ACE_SignalHandler, ACE_SignalHandlerV, and ACE_TRACE.

Referenced by ACE_Sig_Handlers::register_handler(), and ACE_Sig_Handler::register_handler_i().

00140 {
00141   ACE_TRACE ("ACE_Sig_Action::handler");
00142 #if !defined(ACE_HAS_TANDEM_SIGNALS)
00143   this->sa_.sa_handler = ACE_SignalHandlerV (handler);
00144 #else
00145   this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler);
00146 #endif /* !ACE_HAS_TANDEM_SIGNALS */
00147 }

ACE_INLINE sigset_t * ACE_Sig_Action::mask void   ) 
 

Get current signal mask.

Definition at line 110 of file Signal.inl.

References ACE_TRACE.

00111 {
00112   ACE_TRACE ("ACE_Sig_Action::mask");
00113   return &this->sa_.sa_mask;
00114 }

ACE_INLINE void ACE_Sig_Action::mask ACE_Sig_Set  ) 
 

Definition at line 125 of file Signal.inl.

References ACE_TRACE, and ACE_Sig_Set::sigset().

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

ACE_INLINE void ACE_Sig_Action::mask sigset_t *   ) 
 

Set current signal mask.

Definition at line 117 of file Signal.inl.

References ACE_TRACE.

00118 {
00119   ACE_TRACE ("ACE_Sig_Action::mask");
00120   if (ss != 0)
00121     this->sa_.sa_mask = *ss; // Structure assignment
00122 }

ACE_INLINE ACE_Sig_Action::operator struct sigaction *  ) 
 

Definition at line 180 of file Signal.inl.

References ACE_TRACE.

00181 {
00182   ACE_TRACE ("ACE_Sig_Action::operator struct sigaction *");
00183   return &this->sa_;
00184 }

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

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

Definition at line 195 of file Signal.inl.

References ACE_TRACE, get(), 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().

00196 {
00197   ACE_TRACE ("ACE_Sig_Action::register_action");
00198   struct sigaction *sa = oaction == 0 ? 0 : oaction->get ();
00199 
00200   return ACE_OS::sigaction (signum, &this->sa_, sa);
00201 }

ACE_INLINE int ACE_Sig_Action::restore_action int  signum,
ACE_Sig_Action oaction
 

Assign the value of to and make it become the new signal disposition.

Definition at line 211 of file Signal.inl.

References ACE_TRACE, get(), and ACE_OS::sigaction().

00212 {
00213   ACE_TRACE ("ACE_Sig_Action::restore_action");
00214   this->sa_ = *oaction.get (); // Structure assignment
00215   return ACE_OS::sigaction (signum, &this->sa_, 0);
00216 }

ACE_INLINE int ACE_Sig_Action::retrieve_action int  signum  ) 
 

Retrieve the current disposition into .

Definition at line 204 of file Signal.inl.

References ACE_TRACE, and ACE_OS::sigaction().

Referenced by ACE_Sig_Handlers::register_handler().

00205 {
00206   ACE_TRACE ("ACE_Sig_Action::retrieve_action");
00207   return ACE_OS::sigaction (signum, 0, &this->sa_);
00208 }

ACE_INLINE void ACE_Sig_Action::set struct sigaction *   ) 
 

Set current signal action.

Definition at line 166 of file Signal.inl.

References ACE_TRACE.

00167 {
00168   ACE_TRACE ("ACE_Sig_Action::set");
00169   this->sa_ = *sa; // Structure assignment.
00170 }


Member Data Documentation

ACE_Sig_Action::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 222 of file Signal.h.

struct sigaction ACE_Sig_Action::sa_ [private]
 

Controls signal behavior.

Definition at line 226 of file Signal.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:29:36 2006 for ACE by doxygen 1.3.6