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 55 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 81 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 59 of file Reactor.h.

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


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 437 of file Reactor.cpp.

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

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

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

Definition at line 425 of file Reactor.cpp.

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

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

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 702 of file Reactor.cpp.

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

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

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 710 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().

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

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 755 of file Reactor.cpp.

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

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

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 747 of file Reactor.cpp.

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

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

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().

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 407 of file Reactor.cpp.

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

Referenced by ACE_Asynch_Pseudo_Task::stop().

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

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 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_LIB_TEXT.

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

void ACE_Reactor::dump void   )  const
 

Dump the state of the object.

Definition at line 937 of file Reactor.cpp.

References ACE_TRACE, and ACE_Reactor_Impl::dump().

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

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 797 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().

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

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 431 of file Reactor.cpp.

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

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

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 419 of file Reactor.cpp.

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

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

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 813 of file Reactor.cpp.

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

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

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 803 of file Reactor.cpp.

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

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

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 821 of file Reactor.cpp.

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

Referenced by ACE_Asynch_Pseudo_Task::start().

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

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(), ACE_Service_Config::ACE_Service_Config(), 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 827 of file Reactor.cpp.

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

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

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 888 of file Reactor.cpp.

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

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

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 878 of file Reactor.cpp.

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

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

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 784 of file Reactor.cpp.

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

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

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 778 of file Reactor.cpp.

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

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

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_LIB_TEXT.

00206 {
00207   return ACE_LIB_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 764 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().

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

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 847 of file Reactor.cpp.

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

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

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 839 of file Reactor.cpp.

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

Referenced by ACE_Asynch_Pseudo_Task::svc().

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

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 790 of file Reactor.cpp.

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

Referenced by ACE_Event_Handler::~ACE_Event_Handler().

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

int ACE_Reactor::reactor_event_loop_done void   )  [virtual]
 

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

Definition at line 918 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().

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

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 908 of file Reactor.cpp.

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

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

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 898 of file Reactor.cpp.

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

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

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 565 of file Reactor.cpp.

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

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

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 551 of file Reactor.cpp.

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

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

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 530 of file Reactor.cpp.

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

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

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 507 of file Reactor.cpp.

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

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

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.

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 486 of file Reactor.cpp.

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

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

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 463 of file Reactor.cpp.

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

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

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 444 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().

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

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 611 of file Reactor.cpp.

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

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

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 599 of file Reactor.cpp.

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

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

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 591 of file Reactor.cpp.

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

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

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 575 of file Reactor.cpp.

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

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

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 583 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().

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

int ACE_Reactor::requeue_position void   )  [virtual]
 

Get position of the owner thread.

Definition at line 871 of file Reactor.cpp.

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

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

void ACE_Reactor::requeue_position int  position  )  [virtual]
 

Set position of the owner thread.

Definition at line 865 of file Reactor.cpp.

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

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

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 668 of file Reactor.cpp.

References ACE_TRACE.

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

int ACE_Reactor::restart int  r  )  [virtual]
 

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

Definition at line 859 of file Reactor.cpp.

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

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

int ACE_Reactor::restart void   )  [virtual]
 

Get the existing restart value.

Definition at line 853 of file Reactor.cpp.

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

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

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 654 of file Reactor.cpp.

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

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

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 642 of file Reactor.cpp.

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

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

int ACE_Reactor::resume_handler ACE_HANDLE  handle  )  [virtual]
 

Resume handle.

Definition at line 648 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().

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

int ACE_Reactor::resume_handlers void   )  [virtual]
 

Resume all registered handles.

Definition at line 660 of file Reactor.cpp.

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

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

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

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, 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, 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 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, 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, 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 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 679 of file Reactor.cpp.

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

Referenced by ACE_Logging_Strategy::init().

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

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 739 of file Reactor.cpp.

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

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

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 720 of file Reactor.cpp.

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

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

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 925 of file Reactor.cpp.

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

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

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 630 of file Reactor.cpp.

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

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

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 618 of file Reactor.cpp.

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

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

int ACE_Reactor::suspend_handler ACE_HANDLE  handle  )  [virtual]
 

Suspend handle temporarily.

Definition at line 624 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().

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

int ACE_Reactor::suspend_handlers void   )  [virtual]
 

Suspend all registered handles temporarily.

Definition at line 636 of file Reactor.cpp.

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

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

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

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 ACE_Reactor_Impl::timer_queue().

00401 {
00402   ACE_Reactor_Impl *impl = this->implementation_;
00403   return impl->timer_queue ();
00404 }

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 931 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().

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

void ACE_Reactor::wakeup_all_threads void   )  [virtual]
 

Wake up all threads in waiting in the event loop.

Definition at line 833 of file Reactor.cpp.

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

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

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 413 of file Reactor.cpp.

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

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


Member Data Documentation

ACE_Reactor::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 833 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 848 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 844 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 Thu Nov 9 11:27:42 2006 for ACE by doxygen 1.3.6