ACE_Sig_Guard Class Reference

Hold signals in MASK for duration of a C++ statement block. Note that a "0" for mask causes all signals to be held. More...

#include <Signal.h>

Collaboration diagram for ACE_Sig_Guard:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Sig_Guard (ACE_Sig_Set *mask=0, bool condition=true)
 ~ACE_Sig_Guard (void)
 Restore blocked signals.

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

ACE_Sig_Set omask_
 Original signal mask.

bool condition_
 Guard Condition.


Detailed Description

Hold signals in MASK for duration of a C++ statement block. Note that a "0" for mask causes all signals to be held.

Definition at line 235 of file Signal.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_Sig_Guard::ACE_Sig_Guard ACE_Sig_Set mask = 0,
bool  condition = true
 

This is kind of conditional Guard, needed when guard should be activated only when a spcific condition met. When condition == true (default), Guard is activated

Definition at line 221 of file Signal.inl.

References SIG_BLOCK, ACE_OS::sigprocmask(), and ACE_OS::thr_sigsetmask().

00223   : omask_ ()
00224   , condition_ (condition)
00225 {
00226   //ACE_TRACE ("ACE_Sig_Guard::ACE_Sig_Guard");
00227   if (!this->condition_)
00228     return;
00229 
00230 #if defined (ACE_LACKS_UNIX_SIGNALS)
00231   ACE_UNUSED_ARG (mask);
00232 #else
00233   // If MASK is 0 then block all signals!
00234   if (mask == 0)
00235     {
00236 #  if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
00237       ACE_OS::sigprocmask (SIG_BLOCK,
00238                            ACE_OS_Object_Manager::default_mask (),
00239                            (sigset_t *) this->omask_);
00240 #  else
00241       ACE_OS::thr_sigsetmask (SIG_BLOCK,
00242                               ACE_OS_Object_Manager::default_mask (),
00243                               (sigset_t *) this->omask_);
00244 #  endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
00245     }
00246   else
00247 #  if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
00248     ACE_OS::sigprocmask (SIG_BLOCK,
00249                          (sigset_t *) *mask,
00250                          (sigset_t *)
00251                          this->omask_);
00252 #  else
00253     ACE_OS::thr_sigsetmask (SIG_BLOCK,
00254                             (sigset_t *) *mask,
00255                             (sigset_t *)
00256                             this->omask_);
00257 #  endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
00258 #endif /* ACE_LACKS_UNIX_SIGNALS */
00259 }

ACE_Sig_Guard::~ACE_Sig_Guard void   ) 
 

Restore blocked signals.

Definition at line 81 of file Signal.cpp.

References SIG_SETMASK, ACE_OS::sigprocmask(), and ACE_OS::thr_sigsetmask().

00082 {
00083   //ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard");
00084   if (!this->condition_)
00085     return;
00086 
00087 #if !defined (ACE_LACKS_UNIX_SIGNALS)
00088 #if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
00089   ACE_OS::sigprocmask (SIG_SETMASK,
00090                        (sigset_t *) this->omask_,
00091                        0);
00092 #else
00093   ACE_OS::thr_sigsetmask (SIG_SETMASK,
00094                           (sigset_t *) this->omask_,
00095                           0);
00096 #endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
00097 #endif /* !ACE_LACKS_UNIX_SIGNALS */
00098 }


Member Function Documentation

void ACE_Sig_Guard::dump void   )  const
 

Dump the state of an object.

Definition at line 111 of file Signal.cpp.

References ACE_TRACE.

00112 {
00113 #if defined (ACE_HAS_DUMP)
00114   ACE_TRACE ("ACE_Sig_Guard::dump");
00115 #endif /* ACE_HAS_DUMP */
00116 }


Member Data Documentation

ACE_Sig_Guard::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 251 of file Signal.h.

bool ACE_Sig_Guard::condition_ [private]
 

Guard Condition.

Definition at line 258 of file Signal.h.

ACE_Sig_Set ACE_Sig_Guard::omask_ [private]
 

Original signal mask.

Definition at line 255 of file Signal.h.


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