ACE_Event_Handler Class Reference

Provides an abstract interface for handling various types of I/O, timer, and signal events. More...

#include <Event_Handler.h>

Inheritance diagram for ACE_Event_Handler:

Inheritance graph
[legend]
Collaboration diagram for ACE_Event_Handler:

Collaboration graph
[legend]
List of all members.

Public Types

typedef long Reference_Count
 Reference count type.

enum  {
  LO_PRIORITY = 0, HI_PRIORITY = 10, NULL_MASK = 0, READ_MASK = (1 << 0),
  WRITE_MASK = (1 << 1), EXCEPT_MASK = (1 << 2), ACCEPT_MASK = (1 << 3), CONNECT_MASK = (1 << 4),
  TIMER_MASK = (1 << 5), QOS_MASK = (1 << 6), GROUP_QOS_MASK = (1 << 7), SIGNAL_MASK = (1 << 8),
  ALL_EVENTS_MASK, RWE_MASK, DONT_CALL = (1 << 9)
}
enum  { ACE_EVENT_HANDLER_NOT_RESUMED = -1, ACE_REACTOR_RESUMES_HANDLER = 0, ACE_APPLICATION_RESUMES_HANDLER }

Public Member Functions

virtual ~ACE_Event_Handler (void)
 Destructor is virtual to enable proper cleanup.

virtual ACE_HANDLE get_handle (void) const
 Get the I/O handle.

virtual void set_handle (ACE_HANDLE)
 Set the I/O handle.

virtual int priority (void) const
 Get the priority of the Event_Handler.

virtual void priority (int priority)
 Set the priority of the Event_Handler.

virtual int handle_input (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 Called when input events occur (e.g., connection or data).

virtual int handle_output (ACE_HANDLE fd=ACE_INVALID_HANDLE)
virtual int handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 Called when an exceptional events occur (e.g., SIGURG).

virtual int handle_timeout (const ACE_Time_Value &current_time, const void *act=0)
virtual int handle_exit (ACE_Process *)
 Called when a process exits.

virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
virtual int handle_signal (int signum, siginfo_t *=0, ucontext_t *=0)
virtual int resume_handler (void)
virtual int handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
virtual int handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
virtual void reactor (ACE_Reactor *reactor)
 Set the event demultiplexors.

virtual ACE_Reactorreactor (void) const
 Get the event demultiplexors.

virtual ACE_Reactor_Timer_Interfacereactor_timer_interface (void) const
 Get only the reactor's timer related interface.

virtual Reference_Count add_reference (void)
 Increment reference count on the handler.

virtual Reference_Count remove_reference (void)
 Decrement reference count on the handler.

Reference_Counting_Policyreference_counting_policy (void)
 Current Reference_Counting_Policy.


Static Public Member Functions

ACE_THR_FUNC_RETURN read_adapter (void *event_handler)
int register_stdin_handler (ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags=THR_DETACHED)
int remove_stdin_handler (ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr)
 Performs the inverse of the method.


Protected Types

typedef ACE_Atomic_Op< ACE_SYNCH_MUTEX,
Reference_Count
Atomic_Reference_Count
 Typedef for implementation of reference counting.


Protected Member Functions

 ACE_Event_Handler (ACE_Reactor *=0, int priority=ACE_Event_Handler::LO_PRIORITY)
 Force ACE_Event_Handler to be an abstract base class.


Protected Attributes

Atomic_Reference_Count reference_count_
 Reference count.


Private Attributes

int priority_
 Priority of this Event_Handler.

ACE_Reactorreactor_
 Pointer to the various event demultiplexors.

Reference_Counting_Policy reference_counting_policy_
 Reference counting requirements.


Detailed Description

Provides an abstract interface for handling various types of I/O, timer, and signal events.

Subclasses read/write input/output on an I/O descriptor, handle an exception raised on an I/O descriptor, handle a timer's expiration, or handle a signal.

Definition at line 48 of file Event_Handler.h.


Member Typedef Documentation

typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, Reference_Count> ACE_Event_Handler::Atomic_Reference_Count [protected]
 

Typedef for implementation of reference counting.

Definition at line 292 of file Event_Handler.h.

typedef long ACE_Event_Handler::Reference_Count
 

Reference count type.

Definition at line 204 of file Event_Handler.h.

Referenced by remove_reference().


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
LO_PRIORITY 
HI_PRIORITY 
NULL_MASK 
READ_MASK 
WRITE_MASK 
EXCEPT_MASK 
ACCEPT_MASK 
CONNECT_MASK 
TIMER_MASK 
QOS_MASK 
GROUP_QOS_MASK 
SIGNAL_MASK 
ALL_EVENTS_MASK 
RWE_MASK 
DONT_CALL 

Definition at line 51 of file Event_Handler.h.

00052   {
00053     LO_PRIORITY = 0,
00054     HI_PRIORITY = 10,
00055     NULL_MASK = 0,
00056 #if defined (ACE_USE_POLL)
00057     READ_MASK = POLLIN,
00058     WRITE_MASK = POLLOUT,
00059     EXCEPT_MASK = POLLPRI,
00060 #else /* USE SELECT */
00061     READ_MASK = (1 << 0),
00062     WRITE_MASK = (1 << 1),
00063     EXCEPT_MASK = (1 << 2),
00064 #endif /* ACE_USE_POLL */
00065     ACCEPT_MASK = (1 << 3),
00066     CONNECT_MASK = (1 << 4),
00067     TIMER_MASK = (1 << 5),
00068     QOS_MASK = (1 << 6),
00069     GROUP_QOS_MASK = (1 << 7),
00070     SIGNAL_MASK = (1 << 8),
00071     ALL_EVENTS_MASK = READ_MASK |
00072                       WRITE_MASK |
00073                       EXCEPT_MASK |
00074                       ACCEPT_MASK |
00075                       CONNECT_MASK |
00076                       TIMER_MASK |
00077                       QOS_MASK |
00078                       GROUP_QOS_MASK |
00079                       SIGNAL_MASK,
00080     RWE_MASK = READ_MASK |
00081                WRITE_MASK |
00082                EXCEPT_MASK,
00083     DONT_CALL = (1 << 9)
00084   };

anonymous enum
 

Enumeration values:
ACE_EVENT_HANDLER_NOT_RESUMED  The handler is not resumed at all. Could lead to deadlock..
ACE_REACTOR_RESUMES_HANDLER  The reactor takes responsibility of resuming the handler and is the default
ACE_APPLICATION_RESUMES_HANDLER  The application takes responsibility of resuming the handler.

Definition at line 138 of file Event_Handler.h.

00139     {
00140       /// The handler is not resumed at all. Could lead to deadlock..
00141       ACE_EVENT_HANDLER_NOT_RESUMED = -1,
00142       /// The reactor takes responsibility of resuming the handler and
00143       /// is the default
00144       ACE_REACTOR_RESUMES_HANDLER = 0,
00145       /// The application takes responsibility of resuming the handler
00146       ACE_APPLICATION_RESUMES_HANDLER
00147     };


Constructor & Destructor Documentation

ACE_Event_Handler::~ACE_Event_Handler void   )  [virtual]
 

Destructor is virtual to enable proper cleanup.

Definition at line 33 of file Event_Handler.cpp.

References ACE_Reactor::purge_pending_notifications().

00034 {
00035   // ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler");
00036   if (this->reactor_ != 0)
00037     {
00038       ACE_Errno_Guard guard (errno);     // purge may get ENOTSUP
00039       this->reactor_->purge_pending_notifications (this);
00040     }
00041 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Event_Handler::ACE_Event_Handler ACE_Reactor = 0,
int  priority = ACE_Event_Handler::LO_PRIORITY
[protected]
 

Force ACE_Event_Handler to be an abstract base class.

Definition at line 23 of file Event_Handler.cpp.

00025   : reference_count_ (1),
00026     priority_ (p),
00027     reactor_ (r),
00028     reference_counting_policy_ (Reference_Counting_Policy::DISABLED)
00029 {
00030   // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler");
00031 }


Member Function Documentation

ACE_Event_Handler::Reference_Count ACE_Event_Handler::add_reference void   )  [virtual]
 

Increment reference count on the handler.

This method is called when the handler is registered with the Reactor and when the Reactor makes an upcall on the handler. Reference count is 1 when the handler is created.

Returns:
Current reference count.

Definition at line 189 of file Event_Handler.cpp.

References reference_count_, reference_counting_policy(), and ACE_Event_Handler::Reference_Counting_Policy::value().

Referenced by ACE_Event_Handler_var::ACE_Event_Handler_var(), ACE_Select_Reactor_Handler_Repository::bind(), ACE_Dev_Poll_Reactor_Handler_Repository::bind(), ACE_WFMO_Reactor_Handler_Repository::bind_i(), ACE_WFMO_Reactor::complex_dispatch_handler(), ACE_Dev_Poll_Reactor::find_handler(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::find_handler_i(), ACE_TP_Reactor::handle_socket_events(), ACE_WFMO_Reactor_Handler_Repository::handler(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler_i(), ACE_WFMO_Reactor_Notify::notify(), ACE_Select_Reactor_Notify::notify(), ACE_Event_Handler_var::operator=(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::preinvoke(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::registration(), and ACE_WFMO_Reactor::simple_dispatch_handler().

00190 {
00191   int reference_counting_required =
00192     this->reference_counting_policy ().value () ==
00193     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00194 
00195   if (reference_counting_required)
00196     return ++this->reference_count_;
00197   else
00198     return 1;
00199 }

ACE_HANDLE ACE_Event_Handler::get_handle void   )  const [virtual]
 

Get the I/O handle.

Reimplemented in ACE_Acceptor< SVC_HANDLER, >, ACE_Strategy_Acceptor< SVC_HANDLER, >, ACE_Oneshot_Acceptor< SVC_HANDLER, >, ACE_Event_Handler_T< T >, ACE_Name_Proxy, ACE_POSIX_Asynch_Accept, ACE_POSIX_Asynch_Connect, ACE_POSIX_Proactor, ACE_Proactor_Impl, ACE_Service_Manager, ACE_Svc_Handler<, >, ACE_WFMO_Reactor_Notify, ACE_WIN32_Asynch_Connect, ACE_WIN32_Proactor, ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.

Definition at line 46 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Handler_Repository::bind(), ACE_Dev_Poll_Reactor_Handler_Repository::bind(), ACE_WFMO_Reactor_Handler_Repository::bind_i(), ACE_WFMO_Reactor::cancel_wakeup(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_wakeup(), ACE_Dev_Poll_Reactor::cancel_wakeup(), ACE_Select_Reactor_Handler_Repository::dump(), ACE_WFMO_Reactor::mask_ops(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops(), ACE_Dev_Poll_Reactor::mask_ops(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ready_ops(), ACE_Dev_Poll_Reactor::register_handler(), ACE_WFMO_Reactor::register_handler_i(), ACE_WFMO_Reactor::remove_handler(), ACE_Dev_Poll_Reactor::remove_handler(), ACE_WFMO_Reactor::resume_handler(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handler(), ACE_Dev_Poll_Reactor::resume_handler(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handlers(), ACE_WFMO_Reactor::schedule_wakeup(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::schedule_wakeup(), ACE_Dev_Poll_Reactor::schedule_wakeup(), ACE_WFMO_Reactor::suspend_handler(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handler(), ACE_Dev_Poll_Reactor::suspend_handler(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handlers().

00047 {
00048   ACE_TRACE ("ACE_Event_Handler::get_handle");
00049   return ACE_INVALID_HANDLE;
00050 }

int ACE_Event_Handler::handle_close ACE_HANDLE  handle,
ACE_Reactor_Mask  close_mask
[virtual]
 

Called when a <handle_*()> method returns -1 or when the method is called on an ACE_Reactor. The indicates which event has triggered the method callback on a particular .

Reimplemented in ACE_Acceptor< SVC_HANDLER, >, ACE_Strategy_Acceptor< SVC_HANDLER, >, ACE_Oneshot_Acceptor< SVC_HANDLER, >, ACE_Event_Handler_T< T >, ACE_POSIX_Asynch_Accept, ACE_POSIX_Asynch_Connect, ACE_Service_Manager, ACE_Svc_Handler<, >, ACE_WIN32_Asynch_Connect, ACE_WIN32_Proactor, ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.

Definition at line 82 of file Event_Handler.cpp.

References ACE_Reactor_Mask, and ACE_TRACE.

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_type(), ACE_Process_Manager::close(), ACE_Sig_Handler::dispatch(), ACE_Select_Reactor_Notify::dispatch_notify(), ACE_Dev_Poll_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos(), ACE_Process_Manager::notify_proc_handler(), read_adapter(), ACE_Process_Manager::register_handler(), ACE_Dev_Poll_Reactor::remove_handler_i(), ACE_Process_Manager::remove_proc(), and ACE_Select_Reactor_Handler_Repository::unbind().

00083 {
00084   ACE_TRACE ("ACE_Event_Handler::handle_close");
00085   return -1;
00086 }

int ACE_Event_Handler::handle_exception ACE_HANDLE  fd = ACE_INVALID_HANDLE  )  [virtual]
 

Called when an exceptional events occur (e.g., SIGURG).

Reimplemented in ACE_NonBlocking_Connect_Handler< SVC_HANDLER >, ACE_Event_Handler_T< T >, and ACE_WIN32_Asynch_Connect.

Definition at line 109 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), ACE_Dev_Poll_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), and ACE_WFMO_Reactor::upcall().

00110 {
00111   ACE_TRACE ("ACE_Event_Handler::handle_exception");
00112   return -1;
00113 }

int ACE_Event_Handler::handle_exit ACE_Process  )  [virtual]
 

Called when a process exits.

Definition at line 127 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Process_Manager::notify_proc_handler().

00128 {
00129   ACE_TRACE ("ACE_Event_Handler::handle_exit");
00130   return -1;
00131 }

int ACE_Event_Handler::handle_group_qos ACE_HANDLE  = ACE_INVALID_HANDLE  )  [virtual]
 

Definition at line 161 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), and ACE_WFMO_Reactor::upcall().

00162 {
00163   ACE_TRACE ("ACE_Event_Handler::handle_group_qos");
00164   return -1;
00165 }

int ACE_Event_Handler::handle_input ACE_HANDLE  fd = ACE_INVALID_HANDLE  )  [virtual]
 

Called when input events occur (e.g., connection or data).

Reimplemented in ACE_Acceptor< SVC_HANDLER, >, ACE_Oneshot_Acceptor< SVC_HANDLER, >, ACE_NonBlocking_Connect_Handler< SVC_HANDLER >, ACE_Dev_Poll_Reactor_Notify, ACE_Event_Handler_T< T >, ACE_POSIX_Asynch_Accept, ACE_Select_Reactor_Notify, ACE_Service_Manager, ACE_WIN32_Asynch_Connect, and ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >.

Definition at line 91 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), ACE_Dev_Poll_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), read_adapter(), and ACE_WFMO_Reactor::upcall().

00092 {
00093   ACE_TRACE ("ACE_Event_Handler::handle_input");
00094   return -1;
00095 }

int ACE_Event_Handler::handle_output ACE_HANDLE  fd = ACE_INVALID_HANDLE  )  [virtual]
 

Called when output events are possible (e.g., when flow control abates or non-blocking connection completes).

Reimplemented in ACE_NonBlocking_Connect_Handler< SVC_HANDLER >, ACE_Event_Handler_T< T >, ACE_POSIX_Asynch_Connect, and ACE_WIN32_Asynch_Connect.

Definition at line 100 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), ACE_Dev_Poll_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), and ACE_WFMO_Reactor::upcall().

00101 {
00102   ACE_TRACE ("ACE_Event_Handler::handle_output");
00103   return -1;
00104 }

int ACE_Event_Handler::handle_qos ACE_HANDLE  = ACE_INVALID_HANDLE  )  [virtual]
 

Definition at line 154 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), and ACE_WFMO_Reactor::upcall().

00155 {
00156   ACE_TRACE ("ACE_Event_Handler::handle_qos");
00157   return -1;
00158 }

int ACE_Event_Handler::handle_signal int  signum,
siginfo_t = 0,
ucontext_t = 0
[virtual]
 

Called when object is signaled by OS (either via UNIX signals or when a Win32 object becomes signaled).

Reimplemented in ACE_Strategy_Acceptor< SVC_HANDLER, >, ACE_Event_Handler_T< T >, ACE_MMAP_Memory_Pool, ACE_Process_Manager, ACE_Service_Manager, ACE_Shared_Memory_Pool, ACE_Sig_Adapter, ACE_Test_and_Set< ACE_LOCK, TYPE >, ACE_Async_Timer_Queue_Adapter< TQ >, ACE_Wakeup_All_Threads_Handler, ACE_WFMO_Reactor_Notify, and ACE_WIN32_Proactor.

Definition at line 136 of file Event_Handler.cpp.

References ACE_TRACE, and ucontext_t.

Referenced by ACE_Sig_Handler::dispatch(), ACE_Sig_Adapter::handle_signal(), and ACE_WFMO_Reactor::simple_dispatch_handler().

00137 {
00138   ACE_TRACE ("ACE_Event_Handler::handle_signal");
00139   return -1;
00140 }

int ACE_Event_Handler::handle_timeout const ACE_Time_Value current_time,
const void *  act = 0
[virtual]
 

Called when timer expires. represents the current time that the was selected for timeout dispatching and is the asynchronous completion token that was passed in when was invoked.

Reimplemented in ACE_Oneshot_Acceptor< SVC_HANDLER, >, ACE_NonBlocking_Connect_Handler< SVC_HANDLER >, ACE_Event_Handler_T< T >, ACE_Logging_Strategy, ACE_Svc_Handler<, >, ACE_Buffered_Svc_Handler<, >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.

Definition at line 118 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout().

00119 {
00120   ACE_TRACE ("ACE_Event_Handler::handle_timeout");
00121   return -1;
00122 }

void ACE_Event_Handler::priority int  priority  )  [virtual]
 

Set the priority of the Event_Handler.

Definition at line 72 of file Event_Handler.cpp.

References ACE_TRACE, and priority_.

00073 {
00074   ACE_TRACE ("ACE_Event_Handler::priority");
00075   this->priority_ = priority;
00076 }

int ACE_Event_Handler::priority void   )  const [virtual]
 

Get the priority of the Event_Handler.

Definition at line 63 of file Event_Handler.cpp.

References ACE_TRACE, and priority_.

Referenced by ACE_Priority_Reactor::build_bucket().

00064 {
00065   ACE_TRACE ("ACE_Event_Handler::priority");
00066   return this->priority_;
00067 }

ACE_Reactor * ACE_Event_Handler::reactor void   )  const [virtual]
 

Get the event demultiplexors.

Reimplemented in ACE_Connector< SVC_HANDLER, >, and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >.

Definition at line 175 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::ACE_Acceptor(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::ACE_Oneshot_Acceptor(), ACE_Svc_Handler<, >::ACE_Svc_Handler(), ACE_Process_Manager::append_proc(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::cancel(), ACE_Process_Manager::close(), ACE_NonBlocking_Connect_Handler< SVC_HANDLER >::close(), ACE_Logging_Strategy::fini(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_close(), ACE_Strategy_Acceptor< SVC_HANDLER, >::handle_close(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::handle_close(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_input(), ACE_Process_Manager::handle_signal(), ACE_Logging_Strategy::init(), ACE_Svc_Handler<, >::open(), ACE_Process_Manager::open(), ACE_Process_Manager::remove_proc(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::resume(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::resume(), ACE_Svc_Handler<, >::shutdown(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::suspend(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::suspend(), ACE_Process_Manager::wait(), ACE_POSIX_Asynch_Accept::~ACE_POSIX_Asynch_Accept(), ACE_POSIX_Asynch_Connect::~ACE_POSIX_Asynch_Connect(), and ACE_WIN32_Asynch_Connect::~ACE_WIN32_Asynch_Connect().

00176 {
00177   ACE_TRACE ("ACE_Event_Handler::reactor");
00178   return this->reactor_;
00179 }

void ACE_Event_Handler::reactor ACE_Reactor reactor  )  [virtual]
 

Set the event demultiplexors.

Reimplemented in ACE_Connector< SVC_HANDLER, >, and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >.

Definition at line 168 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Reactor::notify(), read_adapter(), ACE_Reactor::register_handler(), register_stdin_handler(), ACE_Reactor::schedule_timer(), ACE_Reactor::schedule_wakeup(), and ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout().

00169 {
00170   ACE_TRACE ("ACE_Event_Handler::reactor");
00171   this->reactor_ = reactor;
00172 }

ACE_Reactor_Timer_Interface * ACE_Event_Handler::reactor_timer_interface void   )  const [virtual]
 

Get only the reactor's timer related interface.

Definition at line 182 of file Event_Handler.cpp.

References ACE_TRACE.

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout().

00183 {
00184   ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface");
00185   return this->reactor_;
00186 }

ACE_THR_FUNC_RETURN ACE_Event_Handler::read_adapter void *  event_handler  )  [static]
 

Used to read from non-socket ACE_HANDLEs in our own thread to work around Win32 limitations that don't allow us to on non-sockets (such as ACE_STDIN). This is commonly used in situations where the Reactor is used to demultiplex read events on ACE_STDIN on UNIX. Note that must be a subclass of ACE_Event_Handler. If the method of this event handler returns we default to reading from ACE_STDIN.

Definition at line 254 of file Event_Handler.cpp.

References ACE_STDIN, handle_close(), handle_input(), ACE_Reactor::notify(), reactor(), and READ_MASK.

Referenced by register_stdin_handler().

00255 {
00256   ACE_Event_Handler *this_ptr = static_cast<ACE_Event_Handler *> (args);
00257   ACE_Reactor *r = this_ptr->reactor ();
00258 
00259   while (this_ptr->handle_input (ACE_STDIN) != -1)
00260     continue;
00261 
00262   this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK);
00263   // It's possible for handle_close() to "delete this" so we need to
00264   // cache the reactor pointer and use it here.
00265   r->notify ();
00266 
00267   return 0;
00268 }

ACE_Event_Handler::Reference_Counting_Policy & ACE_Event_Handler::reference_counting_policy void   ) 
 

Current Reference_Counting_Policy.

Definition at line 246 of file Event_Handler.cpp.

References reference_counting_policy_.

Referenced by add_reference(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_type(), ACE_WFMO_Reactor::complex_dispatch_handler(), ACE_Select_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::preinvoke(), ACE_Dev_Poll_Reactor::remove_handler_i(), remove_reference(), ACE_EH_Dispatch_Info::set(), ACE_WFMO_Reactor::simple_dispatch_handler(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout(), and ACE_Select_Reactor_Handler_Repository::unbind().

00247 {
00248   return this->reference_counting_policy_;
00249 }

int ACE_Event_Handler::register_stdin_handler ACE_Event_Handler eh,
ACE_Reactor reactor,
ACE_Thread_Manager thr_mgr,
int  flags = THR_DETACHED
[static]
 

Abstracts away from the differences between Win32 and ACE with respect to reading from ACE_STDIN, which is non-'able on Win32.

Definition at line 271 of file Event_Handler.cpp.

References ACE_STDIN, reactor(), read_adapter(), READ_MASK, ACE_Reactor::register_handler(), and ACE_Thread_Manager::spawn().

00275 {
00276 #if defined (ACE_WIN32)
00277   ACE_UNUSED_ARG (reactor);
00278 
00279   eh->reactor (reactor);
00280   return thr_mgr->spawn (&read_adapter, static_cast<void *> (eh), flags);
00281 #else
00282   // Keep compilers happy.
00283   ACE_UNUSED_ARG (flags);
00284   ACE_UNUSED_ARG (thr_mgr);
00285   return reactor->register_handler (ACE_STDIN,
00286                                     eh,
00287                                     ACE_Event_Handler::READ_MASK);
00288 #endif /* ACE_WIN32 */
00289 }

ACE_Event_Handler::Reference_Count ACE_Event_Handler::remove_reference void   )  [virtual]
 

Decrement reference count on the handler.

This method is called when the handler is removed from the Reactor and when an upcall made on the handler by the Reactor completes. Handler is deleted when the reference count reaches 0.

Returns:
Current reference count.

Definition at line 202 of file Event_Handler.cpp.

References Reference_Count, reference_count_, reference_counting_policy(), and ACE_Event_Handler::Reference_Counting_Policy::value().

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_timer(), ACE_WFMO_Reactor::complex_dispatch_handler(), ACE_Select_Reactor_Notify::dispatch_notify(), ACE_WFMO_Reactor_Notify::handle_signal(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos(), ACE_Event_Handler_var::operator=(), ACE_TP_Reactor::post_process_socket_event(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::postinvoke(), ACE_WFMO_Reactor_Notify::purge_pending_notifications(), ACE_Select_Reactor_Notify::purge_pending_notifications(), ACE_WFMO_Reactor::simple_dispatch_handler(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout(), ACE_Select_Reactor_Handler_Repository::unbind(), ACE_Dev_Poll_Reactor_Handler_Repository::unbind(), ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard(), and ACE_Event_Handler_var::~ACE_Event_Handler_var().

00203 {
00204   int reference_counting_required =
00205     this->reference_counting_policy ().value () ==
00206     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00207 
00208   if (reference_counting_required)
00209     {
00210       Reference_Count result =
00211         --this->reference_count_;
00212 
00213       if (result == 0)
00214         delete this;
00215 
00216       return result;
00217     }
00218   else
00219     {
00220       return 1;
00221     }
00222 }

int ACE_Event_Handler::remove_stdin_handler ACE_Reactor reactor,
ACE_Thread_Manager thr_mgr
[static]
 

Performs the inverse of the method.

Definition at line 292 of file Event_Handler.cpp.

References ACE_NOTSUP_RETURN, ACE_STDIN, READ_MASK, and ACE_Reactor::remove_handler().

00294 {
00295 #if defined (ACE_WIN32)
00296   ACE_UNUSED_ARG (reactor);
00297   ACE_UNUSED_ARG (thr_mgr);
00298 
00299   // What should we do here?
00300   ACE_NOTSUP_RETURN (-1);
00301 #else
00302   // Keep compilers happy.
00303   ACE_UNUSED_ARG (thr_mgr);
00304   return reactor->remove_handler (ACE_STDIN,
00305                                   ACE_Event_Handler::READ_MASK);
00306 #endif /* ACE_WIN32 */
00307 }

int ACE_Event_Handler::resume_handler void   )  [virtual]
 

Called to figure out whether the handler needs to resumed by the reactor or the application can take care of it. The default value of 0 would be returned which would allow the reactor to take care of resumption of the handler. The application can return a value more than zero and decide to resume the handler themseleves.

Note:
This method is only useful for the ACE_TP_Reactor. Sad that we have to have this method in a class that is supposed to be used across different components in ACE.

Reimplemented in ACE_NonBlocking_Connect_Handler< SVC_HANDLER >.

Definition at line 143 of file Event_Handler.cpp.

References ACE_REACTOR_RESUMES_HANDLER, and ACE_TRACE.

00144 {
00145   ACE_TRACE ("ACE_Event_Handler::resume_handler");
00146 
00147   // Return a default value and allow the reactor to take care of
00148   // resuming the handler
00149   return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER;
00150 }

void ACE_Event_Handler::set_handle ACE_HANDLE   )  [virtual]
 

Set the I/O handle.

Reimplemented in ACE_Event_Handler_T< T >, ACE_POSIX_Asynch_Accept, ACE_POSIX_Asynch_Connect, ACE_Svc_Handler<, >, ACE_WIN32_Asynch_Connect, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.

Definition at line 55 of file Event_Handler.cpp.

References ACE_TRACE.

00056 {
00057   ACE_TRACE ("ACE_Event_Handler::set_handle");
00058 }


Member Data Documentation

int ACE_Event_Handler::priority_ [private]
 

Priority of this Event_Handler.

Definition at line 300 of file Event_Handler.h.

Referenced by priority().

ACE_Reactor* ACE_Event_Handler::reactor_ [private]
 

Pointer to the various event demultiplexors.

Reimplemented in ACE_Asynch_Pseudo_Task, ACE_Connector< SVC_HANDLER, >, ACE_Name_Proxy, and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >.

Definition at line 303 of file Event_Handler.h.

Atomic_Reference_Count ACE_Event_Handler::reference_count_ [protected]
 

Reference count.

Definition at line 295 of file Event_Handler.h.

Referenced by add_reference(), and remove_reference().

Reference_Counting_Policy ACE_Event_Handler::reference_counting_policy_ [private]
 

Reference counting requirements.

Definition at line 306 of file Event_Handler.h.

Referenced by reference_counting_policy().


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