ACE_Reactor Class Reference

The responsibility of this class is to forward all methods to its delegation/implementation class, e.g., ACE_Select_Reactor or ACE_WFMO_Reactor. More...

#include <Reactor.h>

Inheritance diagram for ACE_Reactor:

Inheritance graph
[legend]
Collaboration diagram for ACE_Reactor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef int(* REACTOR_EVENT_HOOK )(ACE_Reactor *)
enum  { GET_MASK = 1, SET_MASK = 2, ADD_MASK = 3, CLR_MASK = 4 }
 Operations on the "ready" mask and the "dispatch" mask. More...


Public Member Functions

virtual int run_reactor_event_loop (REACTOR_EVENT_HOOK=0)
virtual int run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK=0)
virtual int run_reactor_event_loop (ACE_Time_Value &tv, REACTOR_EVENT_HOOK=0)
virtual int run_alertable_reactor_event_loop (ACE_Time_Value &tv, REACTOR_EVENT_HOOK=0)
virtual int end_reactor_event_loop (void)
virtual int reactor_event_loop_done (void)
 Indicate if the Reactor's event loop has been ended.

virtual void reset_reactor_event_loop (void)
 ACE_Reactor (ACE_Reactor_Impl *implementation=0, int delete_implementation=0)
virtual ~ACE_Reactor (void)
 Close down and release all resources.

virtual int open (size_t max_number_of_handles, int restart=0, ACE_Sig_Handler *signal_handler=0, ACE_Timer_Queue *timer_queue=0)
virtual int set_sig_handler (ACE_Sig_Handler *signal_handler)
 Use a user specified signal handler instead.

virtual int timer_queue (ACE_Timer_Queue *tq)
 Set a user-specified timer queue.

virtual ACE_Timer_Queuetimer_queue (void) const
 Return the current ACE_Timer_Queue.

virtual int close (void)
 Close down and release all resources.

virtual int work_pending (const ACE_Time_Value &max_wait_time=ACE_Time_Value::zero)
virtual int handle_events (ACE_Time_Value *max_wait_time=0)
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time=0)
virtual int handle_events (ACE_Time_Value &max_wait_time)
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time)
virtual int register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
virtual int register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
virtual int register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle=ACE_INVALID_HANDLE)
virtual int register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks)
virtual int register_handler (int signum, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp=0, ACE_Event_Handler **old_sh=0, ACE_Sig_Action *old_disp=0)
virtual int register_handler (const ACE_Sig_Set &sigset, ACE_Event_Handler *event_handler, ACE_Sig_Action *sig_action=0)
virtual int remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask masks)
virtual int remove_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks)
virtual int remove_handler (const ACE_Handle_Set &handles, ACE_Reactor_Mask masks)
virtual int remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp=0, int sigkey=-1)
virtual int remove_handler (const ACE_Sig_Set &sigset)
virtual int suspend_handler (ACE_HANDLE handle)
virtual int suspend_handler (ACE_Event_Handler *event_handler)
virtual int suspend_handler (const ACE_Handle_Set &handles)
virtual int suspend_handlers (void)
virtual int resume_handler (ACE_HANDLE handle)
virtual int resume_handler (ACE_Event_Handler *event_handler)
virtual int resume_handler (const ACE_Handle_Set &handles)
virtual int resume_handlers (void)
virtual int resumable_handler (void)
virtual long schedule_timer (ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, const ACE_Time_Value &interval=ACE_Time_Value::zero)
virtual int reset_timer_interval (long timer_id, const ACE_Time_Value &interval)
virtual int cancel_timer (long timer_id, const void **arg=0, int dont_call_handle_close=1)
virtual int cancel_timer (ACE_Event_Handler *event_handler, int dont_call_handle_close=1)
virtual int schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added)
virtual int schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_added)
virtual int cancel_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_cleared)
virtual int cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_cleared)
virtual int notify (ACE_Event_Handler *event_handler=0, ACE_Reactor_Mask masks=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout=0)
virtual void max_notify_iterations (int iterations)
virtual int max_notify_iterations (void)
virtual int purge_pending_notifications (ACE_Event_Handler *eh, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK)
virtual ACE_Event_Handlerfind_handler (ACE_HANDLE handle)
virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler=0)
virtual int handler (int signum, ACE_Event_Handler **event_handler=0)
virtual int initialized (void)
virtual size_t size (void) const
virtual ACE_Locklock (void)
 Returns a reference to the Reactor's internal lock.

virtual void wakeup_all_threads (void)
 Wake up all threads in waiting in the event loop.

virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner=0)
 Transfers ownership of Reactor to the new_owner.

virtual int owner (ACE_thread_t *owner)
 Return the ID of the "owner" thread.

virtual void requeue_position (int position)
 Set position of the owner thread.

virtual int requeue_position (void)
 Get position of the owner thread.

virtual int restart (void)
 Get the existing restart value.

virtual int restart (int r)
 Set a new value for restart and return the original value.

virtual int mask_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops)
virtual int mask_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops)
virtual int ready_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops)
virtual int ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops)
 GET/SET/ADD/CLR the ready "bit" bound with the and .

virtual ACE_Reactor_Implimplementation (void) const
 Get the implementation class.

virtual int current_info (ACE_HANDLE handle, size_t &msg_size)
virtual int uses_event_associations (void)
void dump (void) const
 Dump the state of the object.


Static Public Member Functions

ACE_Reactorinstance (void)
 Get pointer to a process-wide ACE_Reactor.

ACE_Reactorinstance (ACE_Reactor *, int delete_reactor=0)
void close_singleton (void)
 Delete the dynamically allocated Singleton.

const ACE_TCHARdll_name (void)
 Name of the dll in which the dll lives.

const ACE_TCHARname (void)
 Name of the component--ACE_Reactor in this case.

int run_event_loop (void)
int run_alertable_event_loop (void)
int run_event_loop (ACE_Time_Value &tv)
int run_alertable_event_loop (ACE_Time_Value &tv)
int end_event_loop (void)
int event_loop_done (void)
void reset_event_loop (void)
int check_reconfiguration (ACE_Reactor *)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Protected Member Functions

virtual void implementation (ACE_Reactor_Impl *implementation)
 Set the implementation class.

 ACE_Reactor (const ACE_Reactor &)
 Deny access since member-wise won't work...

ACE_Reactoroperator= (const ACE_Reactor &)

Protected Attributes

ACE_Reactor_Implimplementation_
int delete_implementation_

Static Protected Attributes

ACE_Reactorreactor_ = 0
 Pointer to a process-wide ACE_Reactor singleton.

int delete_reactor_ = 0
 Must delete the singleton if non-0.


Detailed Description

The responsibility of this class is to forward all methods to its delegation/implementation class, e.g., ACE_Select_Reactor or ACE_WFMO_Reactor.

Definition at line 58 of file Reactor.h.


Member Typedef Documentation

typedef int(* ACE_Reactor::REACTOR_EVENT_HOOK)(ACE_Reactor *)
 

You can add a hook to various run_event methods and the hook will be called after handling every reactor event. If this function returns 0, will check for the return value of . If it is -1, the will return (pre-maturely.)

Definition at line 84 of file Reactor.h.

Referenced by run_alertable_reactor_event_loop(), and run_reactor_event_loop().


Member Enumeration Documentation

anonymous enum
 

Operations on the "ready" mask and the "dispatch" mask.

Enumeration values:
GET_MASK  Retrieve current value of the the "ready" mask or the "dispatch" mask.
SET_MASK  Set value of bits to new mask (changes the entire mask).
ADD_MASK  Bitwise "or" the value into the mask (only changes enabled bits).
CLR_MASK  Bitwise "and" the negation of the value out of the mask (only changes enabled bits).

Definition at line 62 of file Reactor.h.

00063   {
00064     /// Retrieve current value of the the "ready" mask or the
00065     /// "dispatch" mask.
00066     GET_MASK = 1,
00067     /// Set value of bits to new mask (changes the entire mask).
00068     SET_MASK = 2,
00069     /// Bitwise "or" the value into the mask (only changes enabled
00070     /// bits).
00071     ADD_MASK = 3,
00072     /// Bitwise "and" the negation of the value out of the mask (only
00073     /// changes enabled bits).
00074     CLR_MASK = 4
00075   };


Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Reactor::ACE_Reactor ACE_Reactor_Impl implementation = 0,
int  delete_implementation = 0
 

Create the Reactor using implementation. The flag delete_implementation tells the Reactor whether or not to delete the implementation on destruction.

Definition at line 66 of file Reactor.cpp.

References ACE_NEW, ACE_Select_Reactor, and implementation().

00068   : implementation_ (0),
00069     delete_implementation_ (delete_implementation)
00070 {
00071   this->implementation (impl);
00072 
00073   if (this->implementation () == 0)
00074     {
00075 /*
00076  * Hook to specialize the reactor implementation with the concrete
00077  * Reactor implementation known at compile time. This hook will
00078  * cause the conditionally defined code to be commented out and
00079  * the concrete Reactor directly created.
00080  */
00081 //@@ REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START
00082 #if !defined (ACE_WIN32) \
00083       || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \
00084       || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \
00085       || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) \
00086       || defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL)
00087 #  if defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL)
00088       ACE_NEW (impl,
00089                ACE_TP_Reactor);
00090 #  else
00091 #    if defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL)
00092       ACE_NEW (impl,
00093                ACE_Dev_Poll_Reactor);
00094 #    else
00095       ACE_NEW (impl,
00096                ACE_Select_Reactor);
00097 #    endif /* ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL */
00098 #  endif /* ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL */
00099 #else /* We are on Win32 and we have winsock and ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL is not defined */
00100   #if defined (ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL)
00101       ACE_NEW (impl,
00102                ACE_Msg_WFMO_Reactor);
00103   #else
00104       ACE_NEW (impl,
00105                ACE_WFMO_Reactor);
00106   #endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */
00107 #endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */
00108 
00109 /*
00110  * End hook.
00111  */
00112 //@@ REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END
00113 
00114       this->implementation (impl);
00115       this->delete_implementation_ = 1;
00116     }
00117 }

ACE_Reactor::~ACE_Reactor void   )  [virtual]
 

Close down and release all resources.

Any notifications that remain queued on this reactor instance are lost.

Definition at line 119 of file Reactor.cpp.

References ACE_Reactor_Impl::close(), and implementation().

00120 {
00121   this->implementation ()->close ();
00122   if (this->delete_implementation_)
00123     delete this->implementation ();
00124 }

ACE_Reactor::ACE_Reactor const ACE_Reactor  )  [protected]
 

Deny access since member-wise won't work...


Member Function Documentation

int ACE_Reactor::alertable_handle_events ACE_Time_Value max_wait_time  )  [virtual]
 

Definition at line 436 of file Reactor.cpp.

References ACE_Reactor_Impl::alertable_handle_events(), and implementation().

00437 {
00438   return this->implementation ()->alertable_handle_events (max_wait_time);
00439 }

int ACE_Reactor::alertable_handle_events ACE_Time_Value max_wait_time = 0  )  [virtual]
 

Definition at line 424 of file Reactor.cpp.

References ACE_Reactor_Impl::alertable_handle_events(), and implementation().

00425 {
00426   return this->implementation ()->alertable_handle_events (max_wait_time);
00427 }

int ACE_Reactor::cancel_timer ACE_Event_Handler event_handler,
int  dont_call_handle_close = 1
[virtual]
 

Cancel all timers associated with event handler.

Shorthand for calling cancel_timer(long,const void **,int) multiple times for all timer associated with .

ACE_Event_Handler::handle_close() will be called with <ACE_Event_Handler::TIMER_MASK> only once irrespective of the number of timers associated with the event handler. ACE_Event_Handler::remove_reference() will also be called once for every timer associated with the event handler.

Returns number of handlers cancelled.

Implements ACE_Reactor_Timer_Interface.

Definition at line 701 of file Reactor.cpp.

References ACE_Reactor_Impl::cancel_timer(), and implementation().

00703 {
00704   return this->implementation ()->cancel_timer (event_handler,
00705                                                 dont_call_handle_close);
00706 }

int ACE_Reactor::cancel_timer long  timer_id,
const void **  arg = 0,
int  dont_call_handle_close = 1
[virtual]
 

Cancel timer.

Cancel timer associated with timer_id that was returned from the schedule_timer() method. If arg is non-NULL then it will be set to point to the ``magic cookie'' argument passed in when the handler was registered. This makes it possible to free up the memory and avoid memory leaks. Returns 1 if cancellation succeeded and 0 if the timer_id wasn't found.

On successful cancellation, ACE_Event_Handler::handle_close() will be called with <ACE_Event_Handler::TIMER_MASK>. ACE_Event_Handler::remove_reference() will also be called.

Implements ACE_Reactor_Timer_Interface.

Definition at line 709 of file Reactor.cpp.

References ACE_Reactor_Impl::cancel_timer(), and implementation().

Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::cancel(), ACE_NonBlocking_Connect_Handler< SVC_HANDLER >::close(), ACE_Logging_Strategy::fini(), and ACE_Svc_Handler<, >::shutdown().

00712 {
00713   return this->implementation ()->cancel_timer (timer_id,
00714                                                 arg,
00715                                                 dont_call_handle_close);
00716 }

int ACE_Reactor::cancel_wakeup ACE_HANDLE  handle,
ACE_Reactor_Mask  masks_to_be_cleared
[virtual]
 

Clear from the 's entry. Note that this call does not cause the Reactor to re-examine its set of handlers - the new masks will be noticed the next time the Reactor waits for activity. If there is no other activity expected, or you need immediate re-examination of the wait masks, either call ACE_Reactor::notify after this call, or use ACE_Reactor::register_handler instead.

Definition at line 754 of file Reactor.cpp.

References ACE_Reactor_Mask, ACE_Reactor_Impl::cancel_wakeup(), and implementation().

00756 {
00757   return this->implementation ()->cancel_wakeup (handle,
00758                                                  masks_to_be_cleared);
00759 }

int ACE_Reactor::cancel_wakeup ACE_Event_Handler event_handler,
ACE_Reactor_Mask  masks_to_be_cleared
[virtual]
 

Clear from the 's entry. Note that this call does not cause the Reactor to re-examine its set of handlers - the new masks will be noticed the next time the Reactor waits for activity. If there is no other activity expected, or you need immediate re-examination of the wait masks, either call ACE_Reactor::notify after this call, or use ACE_Reactor::register_handler instead.

Definition at line 746 of file Reactor.cpp.

References ACE_Reactor_Mask, ACE_Reactor_Impl::cancel_wakeup(), and implementation().

00748 {
00749   return this->implementation ()->cancel_wakeup (event_handler,
00750                                                  masks_to_be_cleared);
00751 }

int ACE_Reactor::check_reconfiguration ACE_Reactor  )  [static]
 

The singleton reactor is used by the ACE_Service_Config. Therefore, we must check for the reconfiguration request and handle it after handling an event.

Definition at line 211 of file Reactor.cpp.

References ACE_Service_Config::reconfig_occurred(), and ACE_Service_Config::reconfigure().

Referenced by run_alertable_event_loop(), and run_event_loop().

00212 {
00213 #if !defined (ACE_HAS_WINCE)  &&  !defined (ACE_LACKS_ACE_SVCCONF)
00214   if (ACE_Service_Config::reconfig_occurred ())
00215     {
00216       ACE_Service_Config::reconfigure ();
00217       return 1;
00218     }
00219 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
00220   return 0;
00221 }

int ACE_Reactor::close void   )  [virtual]
 

Close down and release all resources.

Definition at line 406 of file Reactor.cpp.

References ACE_Reactor_Impl::close(), and implementation().

Referenced by ACE_Asynch_Pseudo_Task::stop().

00407 {
00408   return this->implementation ()->close ();
00409 }

void ACE_Reactor::close_singleton void   )  [static]
 

Delete the dynamically allocated Singleton.

Definition at line 183 of file Reactor.cpp.

References ACE_GUARD, ACE_TRACE, delete_reactor_, and reactor_.

00184 {
00185   ACE_TRACE ("ACE_Reactor::close_singleton");
00186 
00187   ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
00188                      *ACE_Static_Object_Lock::instance ()));
00189 
00190   if (ACE_Reactor::delete_reactor_)
00191     {
00192       delete ACE_Reactor::reactor_;
00193       ACE_Reactor::reactor_ = 0;
00194       ACE_Reactor::delete_reactor_ = 0;
00195     }
00196 }

int ACE_Reactor::current_info ACE_HANDLE  handle,
size_t &  msg_size
[virtual]
 

Returns 0, if the size of the current message has been put in size returns -1, if not. ACE_HANDLE allows the reactor to check if the caller is valid. Used for CLASSIX Reactor implementation.

Definition at line 370 of file Reactor.cpp.

References ACE_Reactor_Impl::current_info(), and implementation().

00372 {
00373   return this->implementation ()->current_info (handle, size);
00374 }

const ACE_TCHAR * ACE_Reactor::dll_name void   )  [static]
 

Name of the dll in which the dll lives.

Definition at line 199 of file Reactor.cpp.

References ACE_TEXT.

00200 {
00201   return ACE_TEXT ("ACE");
00202 }

void ACE_Reactor::dump void   )  const
 

Dump the state of the object.

Definition at line 936 of file Reactor.cpp.

References ACE_TRACE, and ACE_Reactor_Impl::dump().

00937 {
00938 #if defined (ACE_HAS_DUMP)
00939   ACE_TRACE ("ACE_Reactor::dump");
00940 
00941   implementation_->dump ();
00942 #endif /* ACE_HAS_DUMP */
00943 }

ACE_INLINE int ACE_Reactor::end_event_loop void   )  [static]
 

Instruct the <ACE_Reactor::instance> to terminate its event loop and notifies the <ACE_Reactor::instance> so that it can wake up and close down gracefully. Note that this method can only be used by the singleton <ACE_Reactor::instance>. Thus, to terminate another reactor, use <ACE_Reactor::end_reactor_event_loop>.

Deprecated:
Use ACE_Reactor::instance()->end_reactor_event_loop() instead

Definition at line 86 of file Reactor.inl.

References ACE_TRACE, end_reactor_event_loop(), and instance().

00087 {
00088   ACE_TRACE ("ACE_Reactor::end_event_loop");
00089   ACE_Reactor::instance ()->end_reactor_event_loop ();
00090 
00091   return 0;
00092 }

int ACE_Reactor::end_reactor_event_loop void   )  [virtual]
 

Instruct the Reactor to terminate its event loop and notifies the Reactor so that it can wake up and deactivate itself. Deactivating the Reactor would allow the Reactor to be shutdown gracefully. Internally the Reactor calls deactivate () on the underlying implementation. Any queued notifications remain queued on return from this method. If the event loop is restarted in the future, the notifications will be dispatched then. If the reactor is closed or deleted without further dispatching, the notifications will be lost.

Definition at line 334 of file Reactor.cpp.

References ACE_TRACE, and ACE_Reactor_Impl::deactivate().

Referenced by end_event_loop(), ACE_Strategy_Acceptor< SVC_HANDLER, >::handle_signal(), and ACE_Asynch_Pseudo_Task::stop().

00335 {
00336   ACE_TRACE ("ACE_Reactor::end_reactor_event_loop");
00337 
00338   this->implementation_->deactivate (1);
00339 
00340   return 0;
00341 }

ACE_INLINE int ACE_Reactor::event_loop_done void   )  [static]
 

Report if the <ACE_Reactor::instance>'s event loop is finished. Note that this method can only be used by the singleton <ACE_Reactor::instance>. Thus, to check another reactor use <ACE_Reactor::reactor_event_loop_done>.

Deprecated:
Use ACE_Reactor::instance()->reactor_event_loop_done() instead

Definition at line 95 of file Reactor.inl.

References ACE_TRACE, instance(), and reactor_event_loop_done().

00096 {
00097   ACE_TRACE ("ACE_Reactor::event_loop_done");
00098   return ACE_Reactor::instance ()->reactor_event_loop_done ();
00099 }

ACE_Event_Handler * ACE_Reactor::find_handler ACE_HANDLE  handle  )  [virtual]
 

Return the Event_Handler associated with handle. Return 0 if handle is not registered.

Reactor will call ACE_Event_Handler::add_reference() on the handler before returning it.

Definition at line 796 of file Reactor.cpp.

References ACE_Reactor_Impl::find_handler(), and implementation().

Referenced by ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::cancel(), and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::close().

00797 {
00798   return this->implementation ()->find_handler (handle);
00799 }

int ACE_Reactor::handle_events ACE_Time_Value max_wait_time  )  [virtual]
 

This method is just like the one above, except the value is a reference and can therefore never be NULL.

The only difference between and is that in the alertable case, the eventloop will return when the system queues an I/O completion routine or an Asynchronous Procedure Call.

Definition at line 430 of file Reactor.cpp.

References ACE_Reactor_Impl::handle_events(), and implementation().

00431 {
00432   return this->implementation ()->handle_events (max_wait_time);
00433 }

int ACE_Reactor::handle_events ACE_Time_Value max_wait_time = 0  )  [virtual]
 

This event loop driver blocks for up to before returning. It will return earlier if events occur. Note that can be 0, in which case this method blocks indefinitely until events occur.

is decremented to reflect how much time this call took. For instance, if a time value of 3 seconds is passed to handle_events and an event occurs after 2 seconds, will equal 1 second. This can be used if an application wishes to handle events for some fixed amount of time.

Returns the total number of timers and I/O ACE_Event_Handlers that were dispatched, 0 if the elapsed without dispatching any handlers, or -1 if an error occurs.

The only difference between and is that in the alertable case, the eventloop will return when the system queues an I/O completion routine or an Asynchronous Procedure Call.

Definition at line 418 of file Reactor.cpp.

References ACE_Reactor_Impl::handle_events(), and implementation().

00419 {
00420   return this->implementation ()->handle_events (max_wait_time);
00421 }

int ACE_Reactor::handler int  signum,
ACE_Event_Handler **  event_handler = 0
[virtual]
 

Check to see if signum is associated with a valid Event_Handler bound to a signal. Return the associated with this if event_handler != 0.

Definition at line 812 of file Reactor.cpp.

References ACE_Reactor_Impl::handler(), and implementation().

00814 {
00815   return this->implementation ()->handler (signum,
00816                                            event_handler);
00817 }

int ACE_Reactor::handler ACE_HANDLE  handle,
ACE_Reactor_Mask  mask,
ACE_Event_Handler **  event_handler = 0
[virtual]
 

Check to see if handle is associated with a valid Event_Handler bound to mask. Return the event_handler associated with this handler if event_handler != 0.

Reactor will call ACE_Event_Handler::add_reference() on the handler before returning it if event_handler != 0.

Definition at line 802 of file Reactor.cpp.

References ACE_Reactor_Mask, ACE_Reactor_Impl::handler(), and implementation().

00805 {
00806   return this->implementation ()->handler (handle,
00807                                            mask,
00808                                            event_handler);
00809 }

void ACE_Reactor::implementation ACE_Reactor_Impl implementation  )  [protected, virtual]
 

Set the implementation class.

Definition at line 364 of file Reactor.cpp.

00365 {
00366   this->implementation_ = impl;
00367 }

ACE_Reactor_Impl * ACE_Reactor::implementation void   )  const [virtual]
 

Get the implementation class.

Definition at line 358 of file Reactor.cpp.

Referenced by ACE_Reactor(), alertable_handle_events(), cancel_timer(), cancel_wakeup(), close(), current_info(), find_handler(), handle_events(), handler(), initialized(), lock(), mask_ops(), max_notify_iterations(), notify(), open(), owner(), purge_pending_notifications(), ready_ops(), register_handler(), remove_handler(), requeue_position(), restart(), resumable_handler(), resume_handler(), resume_handlers(), schedule_timer(), schedule_wakeup(), set_sig_handler(), size(), suspend_handler(), suspend_handlers(), timer_queue(), uses_event_associations(), wakeup_all_threads(), work_pending(), and ~ACE_Reactor().

00359 {
00360   return this->implementation_;
00361 }

int ACE_Reactor::initialized void   )  [virtual]
 

Returns true if Reactor has been successfully initialized, else false.

Definition at line 820 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::initialized().

Referenced by ACE_Asynch_Pseudo_Task::start().

00821 {
00822   return this->implementation ()->initialized ();
00823 }

ACE_Reactor * ACE_Reactor::instance ACE_Reactor ,
int  delete_reactor = 0
[static]
 

Set pointer to a process-wide ACE_Reactor and return existing pointer. If != 0 then we'll delete the Reactor at destruction time.

Definition at line 157 of file Reactor.cpp.

References ACE_GUARD_RETURN, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_reactor_, and reactor_.

00159 {
00160   ACE_TRACE ("ACE_Reactor::instance");
00161 
00162   ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
00163                             *ACE_Static_Object_Lock::instance (), 0));
00164   ACE_Reactor *t = ACE_Reactor::reactor_;
00165   if (delete_reactor != 0)
00166     ACE_Reactor::delete_reactor_ = 1;
00167   else
00168     // We can't safely delete it since we don't know who created it!
00169     ACE_Reactor::delete_reactor_ = 0;
00170 
00171   ACE_Reactor::reactor_ = r;
00172 
00173   // We can't register the Reactor singleton as a framework component twice.
00174   // Therefore we test to see if we had an existing reactor instance, which
00175   // if so means it must have already been registered.
00176   if (t == 0)
00177     ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_);
00178 
00179   return t;
00180 }

ACE_Reactor * ACE_Reactor::instance void   )  [static]
 

Get pointer to a process-wide ACE_Reactor.

Definition at line 134 of file Reactor.cpp.

References ACE_GUARD_RETURN, ACE_NEW_RETURN, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_reactor_, and reactor_.

Referenced by ACE_Schedule_All_Reactive_Strategy< SVC_HANDLER >::ACE_Schedule_All_Reactive_Strategy(), end_event_loop(), event_loop_done(), ACE_Service_Manager::fini(), ACE_Service_Manager::handle_input(), ACE_Strategy_Acceptor< SVC_HANDLER, >::handle_signal(), ACE_Service_Manager::init(), ACE_Service_Config::open_i(), ACE_Service_Config::parse_args_i(), reset_event_loop(), ACE_Service_Manager::resume(), run_alertable_event_loop(), run_event_loop(), and ACE_Service_Manager::suspend().

00135 {
00136   ACE_TRACE ("ACE_Reactor::instance");
00137 
00138   if (ACE_Reactor::reactor_ == 0)
00139     {
00140       // Perform Double-Checked Locking Optimization.
00141       ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
00142                                 *ACE_Static_Object_Lock::instance (), 0));
00143 
00144       if (ACE_Reactor::reactor_ == 0)
00145         {
00146           ACE_NEW_RETURN (ACE_Reactor::reactor_,
00147                           ACE_Reactor,
00148                           0);
00149           ACE_Reactor::delete_reactor_ = 1;
00150           ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_)
00151         }
00152     }
00153   return ACE_Reactor::reactor_;
00154 }

ACE_Lock & ACE_Reactor::lock void   )  [virtual]
 

Returns a reference to the Reactor's internal lock.

Definition at line 826 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::lock().

00827 {
00828   return this->implementation ()->lock ();
00829 }

int ACE_Reactor::mask_ops ACE_HANDLE  handle,
ACE_Reactor_Mask  mask,
int  ops
[virtual]
 

GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle and mask.

Definition at line 887 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::mask_ops().

00890 {
00891   return this->implementation ()->mask_ops (handle,
00892                                             mask,
00893                                             ops);
00894 }

int ACE_Reactor::mask_ops ACE_Event_Handler event_handler,
ACE_Reactor_Mask  mask,
int  ops
[virtual]
 

GET/SET/ADD/CLR the dispatch mask "bit" bound with the event_handler and mask.

Definition at line 877 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::mask_ops().

00880 {
00881   return this->implementation ()->mask_ops (event_handler,
00882                                             mask,
00883                                             ops);
00884 }

int ACE_Reactor::max_notify_iterations void   )  [virtual]
 

Get the maximum number of times that the ACE_Reactor will iterate and dispatch the ACE_Event_Handler's that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop.

Definition at line 783 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::max_notify_iterations().

00784 {
00785   return this->implementation ()->max_notify_iterations ();
00786 }

void ACE_Reactor::max_notify_iterations int  iterations  )  [virtual]
 

Set the maximum number of times that ACE_Reactor will iterate and dispatch the that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop. By default, this is set to -1, which means "iterate until the queue is empty." Setting this to a value like "1 or 2" will increase "fairness" (and thus prevent starvation) at the expense of slightly higher dispatching overhead.

Definition at line 777 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::max_notify_iterations().

00778 {
00779   this->implementation ()->max_notify_iterations (iterations);
00780 }

const ACE_TCHAR * ACE_Reactor::name void   )  [static]
 

Name of the component--ACE_Reactor in this case.

Definition at line 205 of file Reactor.cpp.

References ACE_TEXT.

00206 {
00207   return ACE_TEXT ("ACE_Reactor");
00208 }

int ACE_Reactor::notify ACE_Event_Handler event_handler = 0,
ACE_Reactor_Mask  masks = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value timeout = 0
[virtual]
 

Dispatch user specified events.

Handler will be dispatched irrespective of whether it is registered, not registered, or suspended in the Reactor.

If user specified event is successfully queued, ACE_Event_Handler::add_reference() will be called. After the notify occurs and the upcall to the handler completes, the handler will be implicitly removed from the Reactor and ACE_Event_Handler::remove_reference() will be called. No other upcall reference counting is done.

For I/O or OS events, the upcall is invoked with an ACE_INVALID_HANDLE.

For timer events, the upcall is invoked with a null ACT.

Parameters:
event_handler: IN - Handler on which the event will be dispatched.
masks: IN - Events to be dispatched - multiple events can be OR'd together.
timeout: INOUT - Relative time up to which to wait for user specified event to be queued. If tv is 0, wait indefinitely. When the call returns, tv has the time remaining after the call completes.

Definition at line 763 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Reactor_Impl::notify(), and ACE_Event_Handler::reactor().

Referenced by ACE_Process_Manager::handle_signal(), ACE_Reactor_Notification_Strategy::notify(), and ACE_Event_Handler::read_adapter().

00766 {
00767   // First, try to remember this reactor in the event handler, in case
00768   // the event handler goes away before the notification is delivered.
00769   if (event_handler != 0 && event_handler->reactor () == 0)
00770     event_handler->reactor (this);
00771   return this->implementation ()->notify (event_handler,
00772                                           mask,
00773                                           tv);
00774 }

int ACE_Reactor::open size_t  max_number_of_handles,
int  restart = 0,
ACE_Sig_Handler signal_handler = 0,
ACE_Timer_Queue timer_queue = 0
[virtual]
 

Initialize the ACE_Reactor to manage . If is non-0 then the ACE_Reactor's method will be restarted automatically when occurs. If or are non-0 they are used as the signal handler and timer queue, respectively.

Definition at line 377 of file Reactor.cpp.

References ACE_Timer_Queue, implementation(), and ACE_Reactor_Impl::open().

00381 {
00382   return this->implementation ()->open (size,
00383                                         restart,
00384                                         signal_handler,
00385                                         timer_queue);
00386 }

ACE_Reactor& ACE_Reactor::operator= const ACE_Reactor  )  [protected]
 

int ACE_Reactor::owner ACE_thread_t owner  )  [virtual]
 

Return the ID of the "owner" thread.

Definition at line 846 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::owner().

00847 {
00848   return this->implementation ()->owner (owner);
00849 }

int ACE_Reactor::owner ACE_thread_t  new_owner,
ACE_thread_t old_owner = 0
[virtual]
 

Transfers ownership of Reactor to the new_owner.

Definition at line 838 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::owner().

Referenced by ACE_Asynch_Pseudo_Task::svc().

00840 {
00841   return this->implementation ()->owner (new_owner,
00842                                          old_owner);
00843 }

int ACE_Reactor::purge_pending_notifications ACE_Event_Handler eh,
ACE_Reactor_Mask  = ACE_Event_Handler::ALL_EVENTS_MASK
[virtual]
 

Purge any notifications pending in this reactor for the specified ACE_Event_Handler object. If eh == 0, all notifications for all handlers are removed (but not any notifications posted just to wake up the reactor itself). Returns the number of notifications purged. Returns -1 on error.

After the purging occurs, the handler will be implicitly removed from the Reactor and ACE_Event_Handler::remove_reference() will be called.

Definition at line 789 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::purge_pending_notifications().

00791 {
00792   return this->implementation ()->purge_pending_notifications (eh, mask);
00793 }

int ACE_Reactor::reactor_event_loop_done void   )  [virtual]
 

Indicate if the Reactor's event loop has been ended.

Definition at line 917 of file Reactor.cpp.

References ACE_TRACE, and ACE_Reactor_Impl::deactivated().

Referenced by event_loop_done(), run_alertable_reactor_event_loop(), and run_reactor_event_loop().

00918 {
00919   ACE_TRACE ("ACE_Reactor::reactor_event_loop_done");
00920   return this->implementation_->deactivated ();
00921 }

int ACE_Reactor::ready_ops ACE_HANDLE  handle,
ACE_Reactor_Mask  mask,
int  ops
[virtual]
 

GET/SET/ADD/CLR the ready "bit" bound with the and .

Definition at line 907 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::ready_ops().

00910 {
00911   return this->implementation ()->ready_ops (handle,
00912                                              mask,
00913                                              ops);
00914 }

int ACE_Reactor::ready_ops ACE_Event_Handler event_handler,
ACE_Reactor_Mask  mask,
int  ops
[virtual]
 

GET/SET/ADD/CLR the ready "bit" bound with the and .

Definition at line 897 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::ready_ops().

00900 {
00901   return this->implementation ()->ready_ops (event_handler,
00902                                              mask,
00903                                              ops);
00904 }

int ACE_Reactor::register_handler const ACE_Sig_Set sigset,
ACE_Event_Handler event_handler,
ACE_Sig_Action sig_action = 0
[virtual]
 

Register handler for multiple signals.

Shorthand for calling register_handler(int,ACE_Event_Handler*,ACE_Sig_Action*,ACE_Event_Handler**,ACE_Sig_Action*) multiple times for the same and but different .

Definition at line 564 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::register_handler().

00567 {
00568   return this->implementation ()->register_handler (sigset,
00569                                                     new_sh,
00570                                                     new_disp);
00571 }

int ACE_Reactor::register_handler int  signum,
ACE_Event_Handler new_sh,
ACE_Sig_Action new_disp = 0,
ACE_Event_Handler **  old_sh = 0,
ACE_Sig_Action old_disp = 0
[virtual]
 

Register handler for signals.

Register new_sh to handle the signal signum using the new_disp. Returns the old_sh that was previously registered (if any), along with the old_disp of the signal handler.

Reactor will call ACE_Event_Handler::add_reference() on new_sh and ACE_Event_Handler::remove_reference() on old_sh.

Definition at line 550 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::register_handler().

00555 {
00556   return this->implementation ()->register_handler (signum,
00557                                                     new_sh,
00558                                                     new_disp,
00559                                                     old_sh,
00560                                                     old_disp);
00561 }

int ACE_Reactor::register_handler const ACE_Handle_Set handles,
ACE_Event_Handler event_handler,
ACE_Reactor_Mask  masks
[virtual]
 

Register handler for multiple I/O events.

Shorthand for calling register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), multiple times for the same and but different .

Definition at line 529 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::register_handler().

00532 {
00533   // Remember the old reactor.
00534   ACE_Reactor *old_reactor = event_handler->reactor ();
00535 
00536   // Assign *this* <Reactor> to the <Event_Handler>.
00537   event_handler->reactor (this);
00538 
00539   int result = this->implementation ()->register_handler (handles,
00540                                                           event_handler,
00541                                                           mask);
00542   if (result == -1)
00543     // Reset the old reactor in case of failures.
00544     event_handler->reactor (old_reactor);
00545 
00546   return result;
00547 }

int ACE_Reactor::register_handler ACE_HANDLE  event_handle,
ACE_HANDLE  io_handle,
ACE_Event_Handler event_handler,
ACE_Reactor_Mask  mask
[virtual]
 

Register handler for I/O events.

Similar to register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), except that the user gets to specify the event handle that will be used for this registration. This only applies to Reactors that use event handles for I/O registrations.

Definition at line 506 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::register_handler().

00510 {
00511   // Remember the old reactor.
00512   ACE_Reactor *old_reactor = event_handler->reactor ();
00513 
00514   // Assign *this* <Reactor> to the <Event_Handler>.
00515   event_handler->reactor (this);
00516 
00517   int result = this->implementation ()->register_handler (event_handle,
00518                                                           io_handle,
00519                                                           event_handler,
00520                                                           mask);
00521   if (result == -1)
00522     // Reset the old reactor in case of failures.
00523     event_handler->reactor (old_reactor);
00524 
00525   return result;
00526 }

int ACE_Reactor::register_handler ACE_Event_Handler event_handler,
ACE_HANDLE  event_handle = ACE_INVALID_HANDLE
[virtual]
 

Register handler for OS events.

Register an that will be notified when is signaled. This will call back its hook method.

Reactor will call ACE_Event_Handler::add_reference() for a new handler/handle pair.

This interface is only available Win32 platforms because ACE_HANDLE is an int on non-Win32 platforms and compilers are not able to tell the difference between register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and register_handler(ACE_Event_Handler*,ACE_HANDLE).

Definition at line 485 of file Reactor.cpp.

References implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::register_handler().

00487 {
00488   // Remember the old reactor.
00489   ACE_Reactor *old_reactor = event_handler->reactor ();
00490 
00491   // Assign *this* <Reactor> to the <Event_Handler>.
00492   event_handler->reactor (this);
00493 
00494   int result = this->implementation ()->register_handler (event_handler,
00495                                                           event_handle);
00496   if (result == -1)
00497     // Reset the old reactor in case of failures.
00498     event_handler->reactor (old_reactor);
00499 
00500   return result;
00501 }

int ACE_Reactor::register_handler ACE_HANDLE  io_handle,
ACE_Event_Handler event_handler,
ACE_Reactor_Mask  mask
[virtual]
 

Register handler for I/O events.

Same as register_handler(ACE_Event_Handler*,ACE_Reactor_Mask), except handle is explicitly specified.

Definition at line 462 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::register_handler().

00465 {
00466   // Remember the old reactor.
00467   ACE_Reactor *old_reactor = event_handler->reactor ();
00468 
00469   // Assign *this* <Reactor> to the <Event_Handler>.
00470   event_handler->reactor (this);
00471 
00472   int result = this->implementation ()->register_handler (io_handle,
00473                                                           event_handler,
00474                                                           mask);
00475   if (result == -1)
00476     // Reset the old reactor in case of failures.
00477     event_handler->reactor (old_reactor);
00478 
00479   return result;
00480 }

int ACE_Reactor::register_handler ACE_Event_Handler event_handler,
ACE_Reactor_Mask  mask
[virtual]
 

Register handler for I/O events.

A handler can be associated with multiple handles. A handle cannot be associated with multiple handlers.

The handle will come from ACE_Event_Handler::get_handle().

Reactor will call ACE_Event_Handler::add_reference() for a new handler/handle pair.

If this handler/handle pair has already been registered, any new masks specified will be added. In this case, ACE_Event_Handler::add_reference() will not be called.

If the registered handler is currently suspended, it will remain suspended. When the handler is resumed, it will have the existing masks plus any masks added through this call. Handlers do not have partial suspensions.

Definition at line 443 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::register_handler().

Referenced by ACE_Reactive_Strategy< SVC_HANDLER >::activate_svc_handler(), ACE_Process_Manager::append_proc(), ACE_Service_Manager::handle_input(), ACE_Service_Manager::init(), ACE_Svc_Handler<, >::open(), ACE_Process_Manager::open(), ACE_Service_Config::open_i(), ACE_Service_Config::parse_args_i(), ACE_Asynch_Pseudo_Task::register_io_handler(), and ACE_Event_Handler::register_stdin_handler().

00445 {
00446   // Remember the old reactor.
00447   ACE_Reactor *old_reactor = event_handler->reactor ();
00448 
00449   // Assign *this* <Reactor> to the <Event_Handler>.
00450   event_handler->reactor (this);
00451 
00452   int result = this->implementation ()->register_handler (event_handler,
00453                                                           mask);
00454   if (result == -1)
00455     // Reset the old reactor in case of failures.
00456     event_handler->reactor (old_reactor);
00457 
00458   return result;
00459 }

int ACE_Reactor::remove_handler const ACE_Sig_Set sigset  )  [virtual]
 

Remove multiple signal handler registrations.

Shorthand for calling remove_handler(int,ACE_Sig_Action*,ACE_Sig_Action*,int) multiple times for every signal in .

Definition at line 610 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::remove_handler().

00611 {
00612   return this->implementation ()->remove_handler (sigset);
00613 }

int ACE_Reactor::remove_handler int  signum,
ACE_Sig_Action new_disp,
ACE_Sig_Action old_disp = 0,
int  sigkey = -1
[virtual]
 

Remove signal handler registration.

Remove the ACE_Event_Handler currently associated with signum. Install the new disposition (if given) and return the previous disposition (if desired by the caller).

ACE_Event_Handler::handle_close() will be called with ACE_Event_Handler::SIGNAL_MASK. ACE_Event_Handler::remove_reference() will also be called.

Definition at line 598 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::remove_handler().

00602 {
00603   return this->implementation ()->remove_handler (signum,
00604                                                   new_disp,
00605                                                   old_disp,
00606                                                   sigkey);
00607 }

int ACE_Reactor::remove_handler const ACE_Handle_Set handles,
ACE_Reactor_Mask  masks
[virtual]
 

Remove from multiple registrations.

Shorthand for calling remove_handler(ACE_HANDLE,ACE_Reactor_Mask) multiple times for the same but different .

Definition at line 590 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::remove_handler().

00592 {
00593   return this->implementation ()->remove_handler (handle_set,
00594                                                   mask);
00595 }

int ACE_Reactor::remove_handler ACE_Event_Handler event_handler,
ACE_Reactor_Mask  masks
[virtual]
 

Remove from registration.

Same as remove_handler(ACE_HANDLE,ACE_Reactor_Mask), except comes from ACE_Event_Handler::get_handle().

Definition at line 574 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::remove_handler().

00576 {
00577   return this->implementation ()->remove_handler (event_handler,
00578                                                   mask);
00579 }

int ACE_Reactor::remove_handler ACE_HANDLE  handle,
ACE_Reactor_Mask  masks
[virtual]
 

Remove from registration.

For I/O handles, are removed from the Reactor. Unless includes <ACE_Event_Handler::DONT_CALL>, ACE_Event_Handler::handle_close() will be called with the that have been removed. If all masks have been removed, ACE_Event_Handler::remove_reference() will be called.

For OS handles, the is removed from the Reactor. Unless includes <ACE_Event_Handler::DONT_CALL>, ACE_Event_Handler::handle_close() will be called with <ACE_Event_Handler::NULL_MASK>. ACE_Event_Handler::remove_reference() will also be called.

Definition at line 582 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::remove_handler().

Referenced by ACE_Process_Strategy< SVC_HANDLER >::activate_svc_handler(), ACE_Process_Manager::close(), ACE_NonBlocking_Connect_Handler< SVC_HANDLER >::close(), ACE_Service_Manager::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_Asynch_Pseudo_Task::register_io_handler(), ACE_Asynch_Pseudo_Task::remove_io_handler(), ACE_Process_Manager::remove_proc(), ACE_Event_Handler::remove_stdin_handler(), and ACE_Svc_Handler<, >::shutdown().

00584 {
00585   return this->implementation ()->remove_handler (handle,
00586                                                   mask);
00587 }

int ACE_Reactor::requeue_position void   )  [virtual]
 

Get position of the owner thread.

Definition at line 870 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::requeue_position().

00871 {
00872   return this->implementation ()->requeue_position ();
00873 }

void ACE_Reactor::requeue_position int  position  )  [virtual]
 

Set position of the owner thread.

Definition at line 864 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::requeue_position().

00865 {
00866   this->implementation ()->requeue_position (position);
00867 }

ACE_INLINE void ACE_Reactor::reset_event_loop void   )  [static]
 

Resets the <ACE_Reactor::end_event_loop_> static so that the method can be restarted. Note that this method can only be used by the singleton <ACE_Reactor::instance>. Thus, to reset another reactor use <ACE_Reactor::reset_reactor_event_loop>.

Deprecated:
Use ACE_Reactor::instance()->reset_reactor_event_loop() instead

Definition at line 78 of file Reactor.inl.

References ACE_TRACE, instance(), and reset_reactor_event_loop().

00079 {
00080   ACE_TRACE ("ACE_Reactor::reset_event_loop");
00081 
00082   ACE_Reactor::instance ()->reset_reactor_event_loop ();
00083 }

void ACE_Reactor::reset_reactor_event_loop void   )  [virtual]
 

Resets the <ACE_Reactor::end_event_loop_> static so that the method can be restarted.

Definition at line 344 of file Reactor.cpp.

References ACE_TRACE, and ACE_Reactor_Impl::deactivate().

Referenced by reset_event_loop().

00345 {
00346   ACE_TRACE ("ACE_Reactor::reset_reactor_event_loop");
00347 
00348   this->implementation_->deactivate (0);
00349 }

int ACE_Reactor::reset_timer_interval long  timer_id,
const ACE_Time_Value interval
[virtual]
 

Reset recurring timer interval.

Resets the interval of the timer represented by timer_id to interval, which is specified in relative time to the current . If is equal to <ACE_Time_Value::zero>, the timer will become a non-rescheduling timer. Returns 0 if successful, -1 if not.

This change will not take effect until the next timeout.

Implements ACE_Reactor_Timer_Interface.

Definition at line 667 of file Reactor.cpp.

References ACE_TRACE.

00669 {
00670   ACE_TRACE ("ACE_Reactor::reset_timer_interval");
00671 
00672   return this->implementation ()->reset_timer_interval
00673     (timer_id,
00674      interval);
00675 }

int ACE_Reactor::restart int  r  )  [virtual]
 

Set a new value for restart and return the original value.

Definition at line 858 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::restart().

00859 {
00860   return this->implementation ()->restart (r);
00861 }

int ACE_Reactor::restart void   )  [virtual]
 

Get the existing restart value.

Definition at line 852 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::restart().

00853 {
00854   return this->implementation ()->restart ();
00855 }

int ACE_Reactor::resumable_handler void   )  [virtual]
 

Does the reactor allow the application to resume the handle on its own ie. can it pass on the control of handle resumption to the application. A positive value indicates that the handlers are application resumable. A value of 0 indicates otherwise.

Definition at line 352 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::resumable_handler().

00353 {
00354   return this->implementation ()->resumable_handler ();
00355 }

int ACE_Reactor::resume_handler const ACE_Handle_Set handles  )  [virtual]
 

Resume .

Shorthand for calling resume_handler(ACE_HANDLE) with multiple .

Definition at line 653 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::resume_handler().

00654 {
00655   return this->implementation ()->resume_handler (handles);
00656 }

int ACE_Reactor::resume_handler ACE_Event_Handler event_handler  )  [virtual]
 

Resume event_handler.

Handle is obtained from ACE_Event_Handler::get_handle().

Definition at line 641 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::resume_handler().

00642 {
00643   return this->implementation ()->resume_handler (event_handler);
00644 }

int ACE_Reactor::resume_handler ACE_HANDLE  handle  )  [virtual]
 

Resume handle.

Definition at line 647 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::resume_handler().

Referenced by ACE_Service_Manager::resume(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::resume(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::resume(), and ACE_Asynch_Pseudo_Task::resume_io_handler().

00648 {
00649   return this->implementation ()->resume_handler (handle);
00650 }

int ACE_Reactor::resume_handlers void   )  [virtual]
 

Resume all registered handles.

Definition at line 659 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::resume_handlers().

Referenced by ACE_Schedule_All_Reactive_Strategy< SVC_HANDLER >::resume().

00660 {
00661   return this->implementation ()->resume_handlers ();
00662 }

ACE_INLINE int ACE_Reactor::run_alertable_event_loop ACE_Time_Value tv  )  [static]
 

Definition at line 65 of file Reactor.inl.

References ACE_TRACE, check_reconfiguration(), instance(), and run_alertable_reactor_event_loop().

00066 {
00067   ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00068   ACE_Reactor *r = ACE_Reactor::instance ();
00069 
00070   if (r == 0)
00071     return -1;
00072 
00073   return r->run_alertable_reactor_event_loop
00074     (tv, ACE_Reactor::check_reconfiguration);
00075 }

ACE_INLINE int ACE_Reactor::run_alertable_event_loop void   )  [static]
 

Definition at line 49 of file Reactor.inl.

References ACE_TRACE, check_reconfiguration(), instance(), and run_alertable_reactor_event_loop().

00050 {
00051   ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00052   ACE_Reactor *r = ACE_Reactor::instance ();
00053 
00054   if (r == 0)
00055     return -1;
00056 
00057   return r->run_alertable_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00058 }

int ACE_Reactor::run_alertable_reactor_event_loop ACE_Time_Value tv,
REACTOR_EVENT_HOOK  = 0
[virtual]
 

Definition at line 312 of file Reactor.cpp.

References ACE_TRACE, ACE_Reactor_Impl::alertable_handle_events(), ACE_Reactor_Impl::deactivated(), REACTOR_EVENT_HOOK, and reactor_event_loop_done().

00314 {
00315   ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
00316 
00317   if (this->reactor_event_loop_done ())
00318     return 0;
00319 
00320   for (;;)
00321     {
00322       int result = this->implementation_->alertable_handle_events (tv);
00323 
00324       if (eh != 0 && (*eh)(this))
00325         continue;
00326       else if (result == -1 && this->implementation_->deactivated ())
00327         return 0;
00328       else if (result <= 0)
00329         return result;
00330     }
00331 }

int ACE_Reactor::run_alertable_reactor_event_loop REACTOR_EVENT_HOOK  = 0  )  [virtual]
 

Definition at line 247 of file Reactor.cpp.

References ACE_TRACE, ACE_Reactor_Impl::alertable_handle_events(), ACE_Reactor_Impl::deactivated(), REACTOR_EVENT_HOOK, and reactor_event_loop_done().

Referenced by run_alertable_event_loop().

00248 {
00249   ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
00250 
00251   if (this->reactor_event_loop_done ())
00252     return 0;
00253 
00254   while (1)
00255     {
00256       int result = this->implementation_->alertable_handle_events ();
00257 
00258       if (eh != 0 && (*eh)(this))
00259         continue;
00260       else if (result == -1 && this->implementation_->deactivated ())
00261         return 0;
00262       else if (result == -1)
00263         return -1;
00264     }
00265 
00266   ACE_NOTREACHED (return 0;)
00267 }

ACE_INLINE int ACE_Reactor::run_event_loop ACE_Time_Value tv  )  [static]
 

Run the event loop until the <ACE_Reactor::handle_events> or <ACE_Reactor::alertable_handle_events> methods returns -1, the method is invoked, or the ACE_Time_Value expires. Note that this method can only be used by the singleton <ACE_Reactor::instance>. Thus, to run another reactor use <ACE_Reactor::run_reactor_event_loop>.

Deprecated:
Use ACE_Reactor::instance()->run_reactor_event_loop() instead

Definition at line 33 of file Reactor.inl.

References ACE_TRACE, check_reconfiguration(), instance(), and run_reactor_event_loop().

00034 {
00035   ACE_TRACE ("ACE_Reactor::run_event_loop");
00036   ACE_Reactor *r = ACE_Reactor::instance ();
00037 
00038   if (r == 0)
00039     return -1;
00040 
00041   return r->run_reactor_event_loop
00042     (tv, ACE_Reactor::check_reconfiguration);
00043 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Reactor::run_event_loop void   )  [static]
 

Run the event loop until the <ACE_Reactor::handle_events/ACE_Reactor::alertable_handle_events> method returns -1 or the method is invoked. Note that this method can only be used by the singleton <ACE_Reactor::instance>. Thus, to run another reactor use <ACE_Reactor::run_reactor_event_loop>.

Deprecated:
Use ACE_Reactor::instance()->run_reactor_event_loop() instead

Definition at line 17 of file Reactor.inl.

References ACE_TRACE, check_reconfiguration(), instance(), and run_reactor_event_loop().

00018 {
00019   ACE_TRACE ("ACE_Reactor::run_event_loop");
00020   ACE_Reactor *r = ACE_Reactor::instance ();
00021 
00022   if (r == 0)
00023     return -1;
00024 
00025   return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00026 }

int ACE_Reactor::run_reactor_event_loop ACE_Time_Value tv,
REACTOR_EVENT_HOOK  = 0
[virtual]
 

Run the event loop until the <ACE_Reactor::handle_events> or <ACE_Reactor::alertable_handle_events> methods returns -1, the method is invoked, or the ACE_Time_Value expires.

Definition at line 270 of file Reactor.cpp.

References ACE_TRACE, ACE_Reactor_Impl::deactivated(), ACE_Reactor_Impl::handle_events(), REACTOR_EVENT_HOOK, reactor_event_loop_done(), and ACE_Time_Value::usec().

00272 {
00273   ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
00274 
00275   if (this->reactor_event_loop_done ())
00276     return 0;
00277 
00278   while (1)
00279     {
00280       int result = this->implementation_->handle_events (tv);
00281 
00282       if (eh != 0 && (*eh) (this))
00283         continue;
00284       else if (result == -1)
00285         {
00286           if (this->implementation_->deactivated ())
00287             result = 0;
00288           return result;
00289         }
00290       else if (result == 0)
00291         {
00292           // The <handle_events> method timed out without dispatching
00293           // anything.  Because of rounding and conversion errors and
00294           // such, it could be that the wait loop (WFMO, select, etc.)
00295           // timed out, but the timer queue said it wasn't quite ready
00296           // to expire a timer. In this case, the ACE_Time_Value we
00297           // passed into handle_events won't have quite been reduced
00298           // to 0, and we need to go around again. If we are all the
00299           // way to 0, just return, as the entire time the caller
00300           // wanted to wait has been used up.
00301           if (tv.usec () > 0)
00302             continue;
00303           return 0;
00304         }
00305       // Else there were some events dispatched; go around again
00306     }
00307 
00308   ACE_NOTREACHED (return 0;)
00309 }

int ACE_Reactor::run_reactor_event_loop REACTOR_EVENT_HOOK  = 0  )  [virtual]
 

Run the event loop until the <ACE_Reactor::handle_events/ACE_Reactor::alertable_handle_events> method returns -1 or the method is invoked.

Definition at line 224 of file Reactor.cpp.

References ACE_TRACE, ACE_Reactor_Impl::deactivated(), ACE_Reactor_Impl::handle_events(), REACTOR_EVENT_HOOK, and reactor_event_loop_done().

Referenced by run_event_loop(), and ACE_Asynch_Pseudo_Task::svc().

00225 {
00226   ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
00227 
00228   if (this->reactor_event_loop_done ())
00229     return 0;
00230 
00231   while (1)
00232     {
00233       int result = this->implementation_->handle_events ();
00234 
00235       if (eh != 0 && (*eh)(this))
00236         continue;
00237       else if (result == -1 && this->implementation_->deactivated ())
00238         return 0;
00239       else if (result == -1)
00240         return -1;
00241     }
00242 
00243   ACE_NOTREACHED (return 0;)
00244 }

long ACE_Reactor::schedule_timer ACE_Event_Handler event_handler,
const void *  arg,
const ACE_Time_Value delay,
const ACE_Time_Value interval = ACE_Time_Value::zero
[virtual]
 

Schedule a timer event.

Schedule a timer event that will expire after an amount of time. The return value of this method, a timer_id value, uniquely identifies the in the ACE_Reactor's internal list of timers. This timer_id value can be used to cancel the timer with the cancel_timer() call.

Reactor will call ACE_Event_Handler::add_reference() on the handler. After the timeout occurs and ACE_Event_Handler::handle_timeout() has completed, the handler will be implicitly removed from the Reactor and ACE_Event_Handler::remove_reference() will be called.

See also:
cancel_timer()

reset_timer_interval()

Parameters:
event_handler Event handler to schedule on reactor
arg Argument passed to the handle_timeout() method of event_handler
delay Time interval after which the timer will expire
interval Time interval after which the timer will be automatically rescheduled
Returns:
-1 on failure, a timer_id value on success

Implements ACE_Reactor_Timer_Interface.

Definition at line 678 of file Reactor.cpp.

References implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::schedule_timer().

Referenced by ACE_Logging_Strategy::init().

00682 {
00683   // Remember the old reactor.
00684   ACE_Reactor *old_reactor = event_handler->reactor ();
00685 
00686   // Assign *this* <Reactor> to the <Event_Handler>.
00687   event_handler->reactor (this);
00688 
00689   long result = this->implementation ()->schedule_timer (event_handler,
00690                                                          arg,
00691                                                          delta,
00692                                                          interval);
00693   if (result == -1)
00694     // Reset the old reactor in case of failures.
00695     event_handler->reactor (old_reactor);
00696 
00697   return result;
00698 }

int ACE_Reactor::schedule_wakeup ACE_HANDLE  handle,
ACE_Reactor_Mask  masks_to_be_added
[virtual]
 

Add masks_to_be_added to the handle's entry. associated with handle must already have been registered. Note that this call does not cause the Reactor to re-examine its set of handlers - the new masks will be noticed the next time the Reactor waits for activity. If there is no other activity expected, or you need immediate re-examination of the wait masks, either call ACE_Reactor::notify after this call, or use ACE_Reactor::register_handler instead.

Definition at line 738 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), and ACE_Reactor_Impl::schedule_wakeup().

00740 {
00741   return implementation ()->schedule_wakeup (handle,
00742                                              masks_to_be_added);
00743 }

int ACE_Reactor::schedule_wakeup ACE_Event_Handler event_handler,
ACE_Reactor_Mask  masks_to_be_added
[virtual]
 

Add to the 's entry. must already have been registered. Note that this call does not cause the Reactor to re-examine its set of handlers - the new masks will be noticed the next time the Reactor waits for activity. If there is no other activity expected, or you need immediate re-examination of the wait masks, either call ACE_Reactor::notify after this call, or use ACE_Reactor::register_handler instead.

Definition at line 719 of file Reactor.cpp.

References ACE_Reactor_Mask, implementation(), ACE_Event_Handler::reactor(), and ACE_Reactor_Impl::schedule_wakeup().

00721 {
00722   // Remember the old reactor.
00723   ACE_Reactor *old_reactor = event_handler->reactor ();
00724 
00725   // Assign *this* <Reactor> to the <Event_Handler>.
00726   event_handler->reactor (this);
00727 
00728   int result = this->implementation ()->schedule_wakeup (event_handler,
00729                                                          masks_to_be_added);
00730   if (result == -1)
00731     // Reset the old reactor in case of failures.
00732     event_handler->reactor (old_reactor);
00733 
00734   return result;
00735 }

int ACE_Reactor::set_sig_handler ACE_Sig_Handler signal_handler  )  [virtual]
 

Use a user specified signal handler instead.

Definition at line 388 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::set_sig_handler().

00389 {
00390   return this->implementation ()->set_sig_handler (signal_handler);
00391 }

size_t ACE_Reactor::size void   )  const [virtual]
 

Returns the current size of the Reactor's internal descriptor table.

Definition at line 924 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::size().

00925 {
00926   return this->implementation ()->size ();
00927 }

int ACE_Reactor::suspend_handler const ACE_Handle_Set handles  )  [virtual]
 

Suspend handles temporarily.

Shorthand for calling suspend_handler(ACE_HANDLE) with multiple .

Definition at line 629 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::suspend_handler().

00630 {
00631   return this->implementation ()->suspend_handler (handles);
00632 }

int ACE_Reactor::suspend_handler ACE_Event_Handler event_handler  )  [virtual]
 

Suspend event_handler temporarily.

Handle is obtained from ACE_Event_Handler::get_handle().

Definition at line 617 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::suspend_handler().

00618 {
00619   return this->implementation ()->suspend_handler (event_handler);
00620 }

int ACE_Reactor::suspend_handler ACE_HANDLE  handle  )  [virtual]
 

Suspend handle temporarily.

Definition at line 623 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::suspend_handler().

Referenced by ACE_Asynch_Pseudo_Task::register_io_handler(), ACE_Service_Manager::suspend(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::suspend(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::suspend(), and ACE_Asynch_Pseudo_Task::suspend_io_handler().

00624 {
00625   return this->implementation ()->suspend_handler (handle);
00626 }

int ACE_Reactor::suspend_handlers void   )  [virtual]
 

Suspend all registered handles temporarily.

Definition at line 635 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::suspend_handlers().

Referenced by ACE_Schedule_All_Reactive_Strategy< SVC_HANDLER >::suspend().

00636 {
00637   return this->implementation ()->suspend_handlers ();
00638 }

ACE_Timer_Queue * ACE_Reactor::timer_queue void   )  const [virtual]
 

Return the current ACE_Timer_Queue.

Definition at line 400 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::timer_queue().

00401 {
00402   return this->implementation ()->timer_queue ();
00403 }

int ACE_Reactor::timer_queue ACE_Timer_Queue tq  )  [virtual]
 

Set a user-specified timer queue.

Definition at line 394 of file Reactor.cpp.

References ACE_Timer_Queue, implementation(), and ACE_Reactor_Impl::timer_queue().

00395 {
00396   return this->implementation ()->timer_queue (tq);
00397 }

int ACE_Reactor::uses_event_associations void   )  [virtual]
 

Return 1 if we any event associations were made by the reactor for the handles that it waits on, 0 otherwise.

Definition at line 930 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::uses_event_associations().

Referenced by ACE_Reactive_Strategy< SVC_HANDLER >::activate_svc_handler(), ACE_Service_Manager::handle_input(), and ACE_Oneshot_Acceptor< SVC_HANDLER, >::handle_input().

00931 {
00932   return this->implementation ()->uses_event_associations ();
00933 }

void ACE_Reactor::wakeup_all_threads void   )  [virtual]
 

Wake up all threads in waiting in the event loop.

Definition at line 832 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::wakeup_all_threads().

00833 {
00834   this->implementation ()->wakeup_all_threads ();
00835 }

int ACE_Reactor::work_pending const ACE_Time_Value max_wait_time = ACE_Time_Value::zero  )  [virtual]
 

Returns non-zero if there are I/O events "ready" for dispatching, but does not actually dispatch the event handlers. By default, don't block while checking this, i.e., "poll".

Definition at line 412 of file Reactor.cpp.

References implementation(), and ACE_Reactor_Impl::work_pending().

00413 {
00414   return this->implementation ()->work_pending (max_wait_time);
00415 }


Member Data Documentation

ACE_Reactor::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 836 of file Reactor.h.

int ACE_Reactor::delete_implementation_ [protected]
 

Flag used to indicate whether we are responsible for cleaning up the implementation instance

Definition at line 851 of file Reactor.h.

int ACE_Reactor::delete_reactor_ = 0 [static, protected]
 

Must delete the singleton if non-0.

Definition at line 131 of file Reactor.cpp.

Referenced by close_singleton(), and instance().

ACE_Reactor_Impl* ACE_Reactor::implementation_ [protected]
 

Delegation/implementation class that all methods will be forwarded to.

Definition at line 847 of file Reactor.h.

ACE_Reactor * ACE_Reactor::reactor_ = 0 [static, protected]
 

Pointer to a process-wide ACE_Reactor singleton.

Definition at line 127 of file Reactor.cpp.

Referenced by close_singleton(), and instance().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:56:41 2008 for ACE by doxygen 1.3.6