#include <Event_Handler.h>
Inheritance diagram for ACE_Event_Handler:


| 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 ¤t_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_Reactor * | reactor (void) const | 
| Get the event demultiplexors. | |
| virtual ACE_Reactor_Timer_Interface * | reactor_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_Policy & | reference_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_Reactor * | reactor_ | 
| Pointer to the various event demultiplexors. | |
| Reference_Counting_Policy | reference_counting_policy_ | 
| Reference counting requirements. | |
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.
| 
 | 
| Typedef for implementation of reference counting. 
 Definition at line 292 of file Event_Handler.h. | 
| 
 | 
| Reference count type. 
 Definition at line 204 of file Event_Handler.h. Referenced by remove_reference(). | 
| 
 | 
| 
 
 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   };
 | 
| 
 | 
| 
 
 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     };
 | 
| 
 | 
| Destructor is virtual to enable proper cleanup. 
 Definition at line 34 of file Event_Handler.cpp. 
 00035 {
00036   // ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler");
00037 }
 | 
| 
 | ||||||||||||
| Force ACE_Event_Handler to be an abstract base class. 
 Definition at line 24 of file Event_Handler.cpp. 
 00026 : reference_count_ (1), 00027 priority_ (p), 00028 reactor_ (r), 00029 reference_counting_policy_ (Reference_Counting_Policy::DISABLED) 00030 { 00031 // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); 00032 } | 
| 
 | 
| 
 | 
| 
 | ||||||||||||
| 
 | 
| Called when an exceptional events occur (e.g., SIGURG). 
 Reimplemented in ACE_NonBlocking_Connect_Handler< SVC_HANDLER >, and ACE_Event_Handler_T< T >. Definition at line 105 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Select_Reactor_Notify::dispatch_notify(). 
 00106 {
00107   ACE_TRACE ("ACE_Event_Handler::handle_exception");
00108   return -1;
00109 }
 | 
| 
 | 
| Called when a process exits. 
 Definition at line 123 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Process_Manager::notify_proc_handler(). 
 00124 {
00125   ACE_TRACE ("ACE_Event_Handler::handle_exit");
00126   return -1;
00127 }
 | 
| 
 | 
| 
 Definition at line 157 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Select_Reactor_Notify::dispatch_notify(). 
 00158 {
00159   ACE_TRACE ("ACE_Event_Handler::handle_group_qos");
00160   return -1;
00161 }
 | 
| 
 | 
| 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_Event_Handler_T< T >, ACE_Select_Reactor_Notify, ACE_Service_Manager, and ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >. Definition at line 87 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Select_Reactor_Notify::dispatch_notify(), and read_adapter(). 
 00088 {
00089   ACE_TRACE ("ACE_Event_Handler::handle_input");
00090   return -1;
00091 }
 | 
| 
 | 
| 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 >, and ACE_Event_Handler_T< T >. Definition at line 96 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Select_Reactor_Notify::dispatch_notify(). 
 00097 {
00098   ACE_TRACE ("ACE_Event_Handler::handle_output");
00099   return -1;
00100 }
 | 
| 
 | 
| 
 Definition at line 150 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Select_Reactor_Notify::dispatch_notify(). 
 00151 {
00152   ACE_TRACE ("ACE_Event_Handler::handle_qos");
00153   return -1;
00154 }
 | 
| 
 | ||||||||||||||||
| 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 >, and ACE_Async_Timer_Queue_Adapter< TQ >. Definition at line 132 of file Event_Handler.cpp. References ACE_TRACE, and ucontext_t. Referenced by ACE_Sig_Handler::dispatch(), and ACE_Sig_Adapter::handle_signal(). 
 00133 {
00134   ACE_TRACE ("ACE_Event_Handler::handle_signal");
00135   return -1;
00136 }
 | 
| 
 | ||||||||||||
| 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 114 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout(). 
 00115 {
00116   ACE_TRACE ("ACE_Event_Handler::handle_timeout");
00117   return -1;
00118 }
 | 
| 
 | 
| Set the priority of the Event_Handler. 
 Definition at line 68 of file Event_Handler.cpp. References ACE_TRACE, and priority_. 
 | 
| 
 | 
| Get the priority of the Event_Handler. 
 Definition at line 59 of file Event_Handler.cpp. References ACE_TRACE, and priority_. Referenced by ACE_Priority_Reactor::build_bucket(). 
 | 
| 
 | 
| 
 | 
| Set the event demultiplexors. 
 Reimplemented in ACE_Connector< SVC_HANDLER, >, and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 164 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(), and ACE_Reactor::schedule_wakeup(). 
 | 
| 
 | 
| Get only the reactor's timer related interface. 
 Definition at line 178 of file Event_Handler.cpp. References ACE_TRACE. Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout(). 
 | 
| 
 | 
| 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 event_handler 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 250 of file Event_Handler.cpp. References ACE_STDIN, handle_close(), handle_input(), ACE_Reactor::notify(), reactor(), and READ_MASK. Referenced by register_stdin_handler(). 
 00251 {
00252   ACE_Event_Handler *this_ptr = static_cast<ACE_Event_Handler *> (args);
00253   ACE_Reactor *r = this_ptr->reactor ();
00254 
00255   while (this_ptr->handle_input (ACE_STDIN) != -1)
00256     continue;
00257 
00258   this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK);
00259   // It's possible for handle_close() to "delete this" so we need to
00260   // cache the reactor pointer and use it here.
00261   r->notify ();
00262 
00263   return 0;
00264 }
 | 
| 
 | 
| Current Reference_Counting_Policy. 
 Definition at line 242 of file Event_Handler.cpp. References reference_counting_policy_. Referenced by add_reference(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_type(), ACE_Select_Reactor_Notify::dispatch_notify(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::preinvoke(), remove_reference(), ACE_EH_Dispatch_Info::set(), ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout(), and ACE_Select_Reactor_Handler_Repository::unbind(). 
 00243 {
00244   return this->reference_counting_policy_;
00245 }
 | 
| 
 | ||||||||||||||||||||
| 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 267 of file Event_Handler.cpp. References ACE_STDIN, reactor(), read_adapter(), READ_MASK, ACE_Reactor::register_handler(), and ACE_Thread_Manager::spawn(). 
 00271 {
00272 #if defined (ACE_WIN32)
00273   ACE_UNUSED_ARG (reactor);
00274 
00275   eh->reactor (reactor);
00276   return thr_mgr->spawn (&read_adapter, static_cast<void *> (eh), flags);
00277 #else
00278   // Keep compilers happy.
00279   ACE_UNUSED_ARG (flags);
00280   ACE_UNUSED_ARG (thr_mgr);
00281   return reactor->register_handler (ACE_STDIN,
00282                                     eh,
00283                                     ACE_Event_Handler::READ_MASK);
00284 #endif /* ACE_WIN32 */
00285 }
 | 
| 
 | 
| 
 | ||||||||||||
| Performs the inverse of the method. 
 Definition at line 288 of file Event_Handler.cpp. References ACE_NOTSUP_RETURN, ACE_STDIN, READ_MASK, and ACE_Reactor::remove_handler(). 
 00290 {
00291 #if defined (ACE_WIN32)
00292   ACE_UNUSED_ARG (reactor);
00293 
00294   // What should we do here?
00295   ACE_NOTSUP_RETURN (-1);
00296 #else
00297   return reactor->remove_handler (ACE_STDIN,
00298                                   ACE_Event_Handler::READ_MASK);
00299 #endif /* ACE_WIN32 */
00300 }
 | 
| 
 | 
| 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. 
 
 Reimplemented in ACE_NonBlocking_Connect_Handler< SVC_HANDLER >. Definition at line 139 of file Event_Handler.cpp. References ACE_REACTOR_RESUMES_HANDLER, and ACE_TRACE. 
 00140 {
00141   ACE_TRACE ("ACE_Event_Handler::resume_handler");
00142 
00143   // Return a default value and allow the reactor to take care of
00144   // resuming the handler
00145   return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER;
00146 }
 | 
| 
 | 
| Set the I/O handle. 
 Reimplemented in ACE_Event_Handler_T< T >, ACE_Svc_Handler<, >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >. Definition at line 51 of file Event_Handler.cpp. References ACE_TRACE. 
 00052 {
00053   ACE_TRACE ("ACE_Event_Handler::set_handle");
00054 }
 | 
| 
 | 
| Priority of this Event_Handler. 
 Definition at line 300 of file Event_Handler.h. Referenced by priority(). | 
| 
 | 
| 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. | 
| 
 | 
| Reference count. 
 Definition at line 295 of file Event_Handler.h. Referenced by add_reference(), and remove_reference(). | 
| 
 | 
| Reference counting requirements. 
 Definition at line 306 of file Event_Handler.h. Referenced by reference_counting_policy(). | 
 1.3.6
 
1.3.6