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

ACE_Sig_Adapter Class Reference

Provide an adapter that transforms various types of signal handlers into the scheme used by the <ACE_Reactor>. More...

#include <Signal.h>

Inheritance diagram for ACE_Sig_Adapter:

Inheritance graph
[legend]
Collaboration diagram for ACE_Sig_Adapter:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Sig_Adapter (ACE_Sig_Action &, int sigkey)
 ACE_Sig_Adapter (ACE_Event_Handler *, int sigkey)
 ACE_Sig_Adapter (ACE_Sig_Handler_Ex, int sigkey=0)
 ~ACE_Sig_Adapter (void)
int sigkey (void)
 Returns this signal key that's used to remove this from the <ACE_Reactor>'s internal table. More...

virtual int handle_signal (int, siginfo_t *, ucontext_t *)
 Called by the <Reactor> to dispatch the signal handler. More...


Private Types

enum  { ACE_HANDLER, SIG_ACTION, C_FUNCTION }
 Is this an external handler or an ACE handler? More...


Private Attributes

int sigkey_
 Key for this signal handler (used to remove it). More...

enum ACE_Sig_Adapter:: { ... }  type_
 Is this an external handler or an ACE handler? More...

ACE_Sig_Action sa_
 This is an external handler (ugh). More...

ACE_Event_Handlereh_
 This is an ACE hander. More...

ACE_Sig_Handler_Ex sig_func_
 This is a normal C function. More...


Detailed Description

Provide an adapter that transforms various types of signal handlers into the scheme used by the <ACE_Reactor>.

Definition at line 375 of file Signal.h.


Member Enumeration Documentation

anonymous enum [private]
 

Is this an external handler or an ACE handler?

Enumeration values:
ACE_HANDLER  We're just wrapping an ACE_Event_Handler.
SIG_ACTION  An ACE_Sig_Action.
C_FUNCTION  A normal C function.

Definition at line 395 of file Signal.h.

00396   {
00397     /// We're just wrapping an ACE_Event_Handler.
00398     ACE_HANDLER,
00399     /// An ACE_Sig_Action.
00400     SIG_ACTION,
00401     /// A normal C function.
00402     C_FUNCTION
00403   } type_;


Constructor & Destructor Documentation

ACE_Sig_Adapter::ACE_Sig_Adapter ACE_Sig_Action  ,
int    sigkey
 

Definition at line 443 of file Signal.cpp.

00444   : sigkey_ (sigkey),
00445     type_ (SIG_ACTION),
00446     sa_ (sa)
00447 {
00448   // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
00449 }

ACE_Sig_Adapter::ACE_Sig_Adapter ACE_Event_Handler  ,
int    sigkey
 

Definition at line 451 of file Signal.cpp.

00453   : sigkey_ (sigkey),
00454     type_ (ACE_HANDLER),
00455     eh_ (eh)
00456 {
00457   // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
00458 }

ACE_Sig_Adapter::ACE_Sig_Adapter ACE_Sig_Handler_Ex   ,
int    sigkey = 0
 

Definition at line 460 of file Signal.cpp.

References ACE_Sig_Handler_Ex.

00462   : sigkey_ (sigkey),
00463     type_ (C_FUNCTION),
00464     sig_func_ (sig_func)
00465 {
00466   // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
00467 }

ACE_INLINE ACE_Sig_Adapter::~ACE_Sig_Adapter void   
 

Definition at line 304 of file Signal.i.

00305 {
00306 }


Member Function Documentation

int ACE_Sig_Adapter::handle_signal int   ,
siginfo_t  ,
ucontext_t  
[virtual]
 

Called by the <Reactor> to dispatch the signal handler.

Reimplemented from ACE_Event_Handler.

Definition at line 477 of file Signal.cpp.

References ACE_HANDLER, ACE_Sig_Handler_Ex, ACE_TRACE, C_FUNCTION, eh_, ACE_Event_Handler::handle_signal, ACE_Sig_Action::register_action, sa_, SIG_ACTION, sig_func_, type_, and ucontext_t.

00480 {
00481   ACE_TRACE ("ACE_Sig_Adapter::handle_signal");
00482 
00483   switch (this->type_)
00484     {
00485     case SIG_ACTION:
00486       {
00487         // We have to dispatch a handler that was registered by a
00488         // third-party library.
00489 
00490         ACE_Sig_Action old_disp;
00491 
00492         // Make sure this handler executes in the context it was
00493         // expecting...
00494         this->sa_.register_action (signum, &old_disp);
00495 
00496         ACE_Sig_Handler_Ex sig_func = ACE_Sig_Handler_Ex (this->sa_.handler ());
00497 
00498         (*sig_func) (signum, siginfo, ucontext);
00499         // Restore the original disposition.
00500         old_disp.register_action (signum);
00501         break;
00502       }
00503     case ACE_HANDLER:
00504       this->eh_->handle_signal (signum, siginfo, ucontext);
00505       break;
00506     case C_FUNCTION:
00507       (*this->sig_func_) (signum, siginfo, ucontext);
00508       break;
00509     }
00510   return 0;
00511 }

int ACE_Sig_Adapter::sigkey void   
 

Returns this signal key that's used to remove this from the <ACE_Reactor>'s internal table.

Definition at line 470 of file Signal.cpp.

References ACE_TRACE, and sigkey_.

Referenced by ACE_Sig_Handlers::register_handler, and ACE_Sig_Handlers::remove_handler.

00471 {
00472   ACE_TRACE ("ACE_Sig_Adapter::sigkey");
00473   return this->sigkey_;
00474 }


Member Data Documentation

ACE_Event_Handler* ACE_Sig_Adapter::eh_ [private]
 

This is an ACE hander.

Definition at line 411 of file Signal.h.

Referenced by handle_signal.

ACE_Sig_Action ACE_Sig_Adapter::sa_ [private]
 

This is an external handler (ugh).

Definition at line 408 of file Signal.h.

Referenced by handle_signal.

ACE_Sig_Handler_Ex ACE_Sig_Adapter::sig_func_ [private]
 

This is a normal C function.

Definition at line 414 of file Signal.h.

Referenced by handle_signal.

int ACE_Sig_Adapter::sigkey_ [private]
 

Key for this signal handler (used to remove it).

Definition at line 392 of file Signal.h.

Referenced by sigkey.

enum { ... } ACE_Sig_Adapter::type_ [private]
 

Is this an external handler or an ACE handler?

Referenced by handle_signal.


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