#include <Reactor.h>
Collaboration diagram for ACE_Reactor:

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 Methods | |
| 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. More... | |
| virtual void | reset_reactor_event_loop (void) |
| Resets the <ACE_Reactor::end_event_loop_> static so that the <run_event_loop> method can be restarted. More... | |
| ACE_Reactor (ACE_Reactor_Impl *implementation=0, int delete_implementation=0) | |
| virtual | ~ACE_Reactor (void) |
| Close down and release all resources. More... | |
| 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. More... | |
| virtual int | set_timer_queue (ACE_Timer_Queue *tq) |
| |
| virtual int | timer_queue (ACE_Timer_Queue *tq) |
| Set a user-specified timer queue. More... | |
| virtual ACE_Timer_Queue * | timer_queue (void) const |
| Return the current <ACE_Timer_Queue>. More... | |
| virtual int | close (void) |
| Close down and release all resources. More... | |
| 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) |
| Register <event_handler> with <mask>. The I/O handle will always come from <get_handle> on the <event_handler>. More... | |
| virtual int | register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) |
| Register <event_handler> with <mask>. The I/O handle is provided through the <io_handle> parameter. More... | |
| 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 mask) |
| Register <event_handler> with all the <handles> in the <Handle_Set>. More... | |
| 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 *new_sh, ACE_Sig_Action *new_disp=0) |
| Registers <new_sh> to handle a set of signals <sigset> using the <new_disp>. More... | |
| virtual int | remove_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) |
| virtual int | remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
| virtual int | remove_handler (const ACE_Handle_Set &handle_set, ACE_Reactor_Mask mask) |
| 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) |
| Calls <remove_handler> for every signal in <sigset>. More... | |
| virtual int | suspend_handler (ACE_Event_Handler *event_handler) |
| Suspend <event_handler> temporarily. Use <ACE_Event_Handler::get_handle> to get the handle. More... | |
| virtual int | suspend_handler (ACE_HANDLE handle) |
| Suspend <handle> temporarily. More... | |
| virtual int | suspend_handler (const ACE_Handle_Set &handles) |
| Suspend all <handles> in handle set temporarily. More... | |
| virtual int | suspend_handlers (void) |
| Suspend all <handles> temporarily. More... | |
| virtual int | resume_handler (ACE_Event_Handler *event_handler) |
| Resume <event_handler>. Use <ACE_Event_Handler::get_handle> to get the handle. More... | |
| virtual int | resume_handler (ACE_HANDLE handle) |
| Resume <handle>. More... | |
| virtual int | resume_handler (const ACE_Handle_Set &handles) |
| Resume all <handles> in handle set. More... | |
| virtual int | resume_handlers (void) |
| Resume all <handles>. More... | |
| virtual int | resumable_handler (void) |
| 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. More... | |
| 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 (ACE_Event_Handler *event_handler, int dont_call_handle_close=1) |
| Cancel all <Event_Handler>s that match the address of <event_handler>. Returns number of handlers cancelled. More... | |
| virtual int | cancel_timer (long timer_id, const void **arg=0, int dont_call_handle_close=1) |
| virtual int | schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added) |
| Add <masks_to_be_added> to the <event_handler>'s entry. <event_handler> 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. More... | |
| virtual int | schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_added) |
| Add <masks_to_be_added> to the <handle>'s entry. <event_handler> 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. More... | |
| virtual int | cancel_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_cleared) |
| Clear <masks_to_be_cleared> from the <event_handler>'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. More... | |
| virtual int | cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_cleared) |
| Clear <masks_to_be_cleared> from the <handle>'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. More... | |
| virtual int | notify (ACE_Event_Handler *event_handler=0, ACE_Reactor_Mask mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *tv=0) |
| virtual void | max_notify_iterations (int iterations) |
| virtual int | max_notify_iterations (void) |
| virtual int | purge_pending_notifications (ACE_Event_Handler *, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
| 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) |
| Returns true if Reactor has been successfully initialized, else false. More... | |
| virtual size_t | size (void) const |
| Returns the current size of the Reactor's internal descriptor table. More... | |
| virtual ACE_Lock & | lock (void) |
| Returns a reference to the Reactor's internal lock. More... | |
| virtual void | wakeup_all_threads (void) |
| Wake up all threads in waiting in the event loop. More... | |
| virtual int | owner (ACE_thread_t new_owner, ACE_thread_t *old_owner=0) |
| Transfers ownership of Reactor to the <new_owner>. More... | |
| virtual int | owner (ACE_thread_t *owner) |
| Return the ID of the "owner" thread. More... | |
| virtual void | requeue_position (int position) |
| Set position of the owner thread. More... | |
| virtual int | requeue_position (void) |
| Get position of the owner thread. More... | |
| virtual int | restart (void) |
| Get the existing restart value. More... | |
| virtual int | restart (int r) |
| Set a new value for restart and return the original value. More... | |
| virtual int | mask_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops) |
| GET/SET/ADD/CLR the dispatch mask "bit" bound with the <event_handler> and <mask>. More... | |
| virtual int | mask_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops) |
| GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle> and <mask>. More... | |
| virtual int | ready_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops) |
| GET/SET/ADD/CLR the ready "bit" bound with the <event_handler> and <mask>. More... | |
| virtual int | ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops) |
| GET/SET/ADD/CLR the ready "bit" bound with the <handle> and <mask>. More... | |
| virtual ACE_Reactor_Impl * | implementation (void) const |
| Get the implementation class. More... | |
| virtual int | current_info (ACE_HANDLE handle, size_t &msg_size) |
| virtual int | uses_event_associations (void) |
| Return 1 if we any event associations were made by the reactor for the handles that it waits on, 0 otherwise. More... | |
| void | dump (void) const |
| Dump the state of the object. More... | |
Static Public Methods | |
| ACE_Reactor * | instance (void) |
| Get pointer to a process-wide <ACE_Reactor>. More... | |
| ACE_Reactor * | instance (ACE_Reactor *, int delete_reactor=0) |
| void | close_singleton (void) |
| Delete the dynamically allocated Singleton. More... | |
| const ACE_TCHAR * | dll_name (void) |
| Name of the dll in which the dll lives. More... | |
| const ACE_TCHAR * | name (void) |
| Name of the component--ACE_Reactor in this case. More... | |
| 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. More... | |
Protected Methods | |
| virtual void | implementation (ACE_Reactor_Impl *implementation) |
| Set the implementation class. More... | |
| ACE_Reactor (const ACE_Reactor &) | |
| Deny access since member-wise won't work... More... | |
| ACE_Reactor & | operator= (const ACE_Reactor &) |
Protected Attributes | |
| ACE_Reactor_Impl * | implementation_ |
| Delegation/implementation class that all methods will be forwarded to. More... | |
| int | delete_implementation_ |
| Flag used to indicate whether we are responsible for cleaning up the implementation instance. More... | |
Static Protected Attributes | |
| ACE_Reactor * | reactor_ = 0 |
| Pointer to a process-wide <ACE_Reactor> singleton. More... | |
| int | delete_reactor_ = 0 |
| Must delete the <reactor_> singleton if non-0. More... | |
Definition at line 47 of file Reactor.h.
|
|
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, <run_reactor_event_loop> will check for the return value of <handle_event>. If it is -1, the <run_reactor_event_loop> will return (pre-maturely.) |
|
|
Operations on the "ready" mask and the "dispatch" mask.
Definition at line 51 of file Reactor.h.
00052 {
00053 /// Retrieve current value of the the "ready" mask or the
00054 /// "dispatch" mask.
00055 GET_MASK = 1,
00056 /// Set value of bits to new mask (changes the entire mask).
00057 SET_MASK = 2,
00058 /// Bitwise "or" the value into the mask (only changes enabled
00059 /// bits).
00060 ADD_MASK = 3,
00061 /// Bitwise "and" the negation of the value out of the mask (only
00062 /// changes enabled bits).
00063 CLR_MASK = 4
00064 };
|
|
||||||||||||
|
Create the Reactor using <implementation>. The flag <delete_implementation> tells the Reactor whether or not to delete the <implementation> on destruction. Definition at line 29 of file Reactor.cpp. References ACE_NEW, delete_implementation_, and implementation.
00031 : implementation_ (0), 00032 delete_implementation_ (delete_implementation) 00033 { 00034 this->implementation (impl); 00035 00036 if (this->implementation () == 0) 00037 { 00038 #if !defined (ACE_WIN32) \ 00039 || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \ 00040 || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \ 00041 || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) 00042 #if defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) 00043 ACE_NEW (impl, 00044 ACE_TP_Reactor); 00045 #else 00046 ACE_NEW (impl, 00047 ACE_Select_Reactor); 00048 #endif /* ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL */ 00049 #else /* We are on Win32 and we have winsock and ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL is not defined */ 00050 #if defined (ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL) 00051 ACE_NEW (impl, 00052 ACE_Msg_WFMO_Reactor); 00053 #else 00054 ACE_NEW (impl, 00055 ACE_WFMO_Reactor); 00056 #endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */ 00057 #endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */ 00058 this->implementation (impl); 00059 this->delete_implementation_ = 1; 00060 } 00061 } |
|
|
Close down and release all resources. Any notifications that remain queued on this reactor instance are lost. Definition at line 63 of file Reactor.cpp. References delete_implementation_, and implementation.
00064 {
00065 if (this->delete_implementation_)
00066 delete this->implementation ();
00067 }
|
|
|
Deny access since member-wise won't work...
|
|
|
Definition at line 188 of file Reactor.i. References ACE_Reactor_Impl::alertable_handle_events, and implementation.
00189 {
00190 return this->implementation ()->alertable_handle_events (max_wait_time);
00191 }
|
|
|
Definition at line 176 of file Reactor.i. References ACE_Reactor_Impl::alertable_handle_events, and implementation.
00177 {
00178 return this->implementation ()->alertable_handle_events (max_wait_time);
00179 }
|
|
||||||||||||||||
|
Cancel the single <Event_Handler> that matches the <timer_id> value, which was returned from the schedule method. If arg is non-NULL then it will be set to point to the ``magic cookie'' argument passed in when the Event_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. Definition at line 461 of file Reactor.i. References ACE_Reactor_Impl::cancel_timer, and implementation.
00464 {
00465 return this->implementation ()->cancel_timer (timer_id,
00466 arg,
00467 dont_call_handle_close);
00468 }
|
|
||||||||||||
|
Cancel all <Event_Handler>s that match the address of <event_handler>. Returns number of handlers cancelled.
Definition at line 453 of file Reactor.i. References ACE_Reactor_Impl::cancel_timer, and implementation. Referenced by ACE_Oneshot_Acceptor::cancel, ACE_Logging_Strategy::fini, and ACE_Svc_Handler::shutdown.
00455 {
00456 return this->implementation ()->cancel_timer (event_handler,
00457 dont_call_handle_close);
00458 }
|
|
||||||||||||
|
Clear <masks_to_be_cleared> from the <handle>'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 506 of file Reactor.i. References ACE_Reactor_Mask, ACE_Reactor_Impl::cancel_wakeup, and implementation.
00508 {
00509 return this->implementation ()->cancel_wakeup (handle,
00510 masks_to_be_cleared);
00511 }
|
|
||||||||||||
|
Clear <masks_to_be_cleared> from the <event_handler>'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 498 of file Reactor.i. References ACE_Reactor_Mask, ACE_Reactor_Impl::cancel_wakeup, and implementation.
00500 {
00501 return this->implementation ()->cancel_wakeup (event_handler,
00502 masks_to_be_cleared);
00503 }
|
|
|
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 154 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.
00155 {
00156 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
00157 if (ACE_Service_Config::reconfig_occurred ())
00158 {
00159 ACE_Service_Config::reconfigure ();
00160 return 1;
00161 }
00162 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
00163 return 0;
00164 }
|
|
|
Close down and release all resources.
Definition at line 158 of file Reactor.i. References ACE_Reactor_Impl::close, and implementation. Referenced by ACE_Asynch_Pseudo_Task::stop.
00159 {
00160 return this->implementation ()->close ();
00161 }
|
|
|
Delete the dynamically allocated Singleton.
Definition at line 126 of file Reactor.cpp. References ACE_GUARD, ACE_MT, ACE_TRACE, delete_reactor_, ACE_Static_Object_Lock::instance, and reactor_.
00127 {
00128 ACE_TRACE ("ACE_Reactor::close_singleton");
00129
00130 ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
00131 *ACE_Static_Object_Lock::instance ()));
00132
00133 if (ACE_Reactor::delete_reactor_)
00134 {
00135 delete ACE_Reactor::reactor_;
00136 ACE_Reactor::reactor_ = 0;
00137 ACE_Reactor::delete_reactor_ = 0;
00138 }
00139 }
|
|
||||||||||||
|
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 20 of file Reactor.i. References ACE_Reactor_Impl::current_info, implementation, and size.
00022 {
00023 return this->implementation ()->current_info (handle, size);
00024 }
|
|
|
Name of the dll in which the dll lives.
Definition at line 142 of file Reactor.cpp. References ACE_LIB_TEXT.
00143 {
00144 return ACE_LIB_TEXT ("ACE");
00145 }
|
|
|
Dump the state of the object.
Definition at line 304 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::dump, and implementation_.
00305 {
00306 ACE_TRACE ("ACE_Reactor::dump");
00307
00308 implementation_->dump ();
00309 }
|
|
|
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>.
Definition at line 99 of file Reactor.i. References ACE_TRACE, end_reactor_event_loop, and instance. Referenced by ACE_Strategy_Acceptor::handle_signal.
00100 {
00101 ACE_TRACE ("ACE_Reactor::end_event_loop");
00102 ACE_Reactor::instance ()->end_reactor_event_loop ();
00103
00104 return 0;
00105 }
|
|
|
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 279 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::deactivate, and implementation_. Referenced by end_event_loop, and ACE_Asynch_Pseudo_Task::stop.
00280 {
00281 ACE_TRACE ("ACE_Reactor::end_reactor_event_loop");
00282
00283 this->implementation_->deactivate (1);
00284
00285 return 0;
00286 }
|
|
|
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>.
Definition at line 115 of file Reactor.i. References ACE_TRACE, instance, and reactor_event_loop_done.
00116 {
00117 ACE_TRACE ("ACE_Reactor::event_loop_done");
00118 return ACE_Reactor::instance ()->reactor_event_loop_done ();
00119 }
|
|
|
This method is just like the one above, except the <max_wait_time> value is a reference and can therefore never be NULL. The only difference between <alertable_handle_events> and <handle_events> 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 182 of file Reactor.i. References ACE_Reactor_Impl::handle_events, and implementation.
00183 {
00184 return this->implementation ()->handle_events (max_wait_time);
00185 }
|
|
|
This event loop driver blocks for up to <max_wait_time> before returning. It will return earlier if events occur. Note that <max_wait_time> can be 0, in which case this method blocks indefinitely until events occur. <max_wait_time> 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, <max_wait_time> 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_Handler>s that were dispatched, 0 if the <max_wait_time> elapsed without dispatching any handlers, or -1 if an error occurs. The only difference between <alertable_handle_events> and <handle_events> 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 170 of file Reactor.i. References ACE_Reactor_Impl::handle_events, and implementation.
00171 {
00172 return this->implementation ()->handle_events (max_wait_time);
00173 }
|
|
||||||||||||
|
Check to see if <signum> is associated with a valid Event_Handler bound to a signal. Return the <event_handler> associated with this <handler> if <event_handler> != 0. Definition at line 558 of file Reactor.i. References ACE_Reactor_Impl::handler, and implementation.
00560 {
00561 return this->implementation ()->handler (signum,
00562 event_handler);
00563 }
|
|
||||||||||||||||
|
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. Definition at line 548 of file Reactor.i. References ACE_Reactor_Mask, ACE_Reactor_Impl::handler, and implementation.
00551 {
00552 return this->implementation ()->handler (handle,
00553 mask,
00554 event_handler);
00555 }
|
|
|
Set the implementation class.
Definition at line 14 of file Reactor.i. References implementation_.
00015 {
00016 this->implementation_ = impl;
00017 }
|
|
|
Get the implementation class.
Definition at line 8 of file Reactor.i. References implementation_. Referenced by ACE_Reactor, alertable_handle_events, cancel_timer, cancel_wakeup, close, current_info, 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.
00009 {
00010 return this->implementation_;
00011 }
|
|
|
Returns true if Reactor has been successfully initialized, else false.
Definition at line 566 of file Reactor.i. References implementation, and ACE_Reactor_Impl::initialized. Referenced by ACE_Asynch_Pseudo_Task::start, and ACE_Asynch_Pseudo_Task::stop.
00567 {
00568 return this->implementation ()->initialized ();
00569 }
|
|
||||||||||||
|
Set pointer to a process-wide <ACE_Reactor> and return existing pointer. If <delete_reactor> != 0 then we'll delete the Reactor at destruction time. Definition at line 100 of file Reactor.cpp. References ACE_GUARD_RETURN, ACE_MT, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_reactor_, ACE_Static_Object_Lock::instance, and reactor_.
00102 {
00103 ACE_TRACE ("ACE_Reactor::instance");
00104
00105 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
00106 *ACE_Static_Object_Lock::instance (), 0));
00107 ACE_Reactor *t = ACE_Reactor::reactor_;
00108 if (delete_reactor != 0)
00109 ACE_Reactor::delete_reactor_ = 1;
00110 else
00111 // We can't safely delete it since we don't know who created it!
00112 ACE_Reactor::delete_reactor_ = 0;
00113
00114 ACE_Reactor::reactor_ = r;
00115
00116 // We can't register the Reactor singleton as a framework component twice.
00117 // Therefore we test to see if we had an existing reactor instance, which
00118 // if so means it must have already been registered.
00119 if (t == 0)
00120 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_);
00121
00122 return t;
00123 }
|
|
|
|
Returns a reference to the Reactor's internal lock.
Definition at line 572 of file Reactor.i. References implementation, and ACE_Reactor_Impl::lock.
00573 {
00574 return this->implementation ()->lock ();
00575 }
|
|
||||||||||||||||
|
GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle> and <mask>.
Definition at line 633 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::mask_ops.
00636 {
00637 return this->implementation ()->mask_ops (handle,
00638 mask,
00639 ops);
00640 }
|
|
||||||||||||||||
|
GET/SET/ADD/CLR the dispatch mask "bit" bound with the <event_handler> and <mask>.
Definition at line 623 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::mask_ops.
00626 {
00627 return this->implementation ()->mask_ops (event_handler,
00628 mask,
00629 ops);
00630 }
|
|
|
Get the maximum number of times that the ACE_Reactor will iterate and dispatch the <ACE_Event_Handlers> that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop. Definition at line 535 of file Reactor.i. References implementation, and ACE_Reactor_Impl::max_notify_iterations.
00536 {
00537 return this->implementation ()->max_notify_iterations ();
00538 }
|
|
|
Set the maximum number of times that ACE_Reactor will iterate and dispatch the <ACE_Event_Handlers> 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 529 of file Reactor.i. References implementation, and ACE_Reactor_Impl::max_notify_iterations.
00530 {
00531 this->implementation ()->max_notify_iterations (iterations);
00532 }
|
|
|
Name of the component--ACE_Reactor in this case.
Definition at line 148 of file Reactor.cpp. References ACE_LIB_TEXT.
00149 {
00150 return ACE_LIB_TEXT ("ACE_Reactor");
00151 }
|
|
||||||||||||||||
|
Notify <event_handler> of <mask> event. The <ACE_Time_Value> indicates how long to blocking trying to notify. If <timeout> == 0, the caller will block until action is possible, else will wait until the relative time specified in <timeout> elapses). Note that <mask> can only be one of the pre-defined <ACE_Event_Handler> masks, e.g., <READ_MASK>, <WRITE_MASK>, or <EXCEPT_MASK>. Definition at line 515 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Reactor_Impl::notify, and ACE_Event_Handler::reactor. Referenced by ACE_Process_Manager::handle_signal, and ACE_Reactor_Notification_Strategy::notify.
00518 {
00519 // First, try to remember this reactor in the event handler, in case
00520 // the event handler goes away before the notification is delivered.
00521 if (event_handler != 0 && event_handler->reactor () == 0)
00522 event_handler->reactor (this);
00523 return this->implementation ()->notify (event_handler,
00524 mask,
00525 tv);
00526 }
|
|
||||||||||||||||||||
|
Initialize the <ACE_Reactor> to manage <max_number_of_handles>. If <restart> is non-0 then the <ACE_Reactor>'s <handle_events> method will be restarted automatically when <EINTR> occurs. If <signal_handler> or <timer_queue> are non-0 they are used as the signal handler and timer queue, respectively. Definition at line 122 of file Reactor.i. References implementation, ACE_Reactor_Impl::open, restart, and size.
00126 {
00127 return this->implementation ()->open (size,
00128 restart,
00129 signal_handler,
00130 timer_queue);
00131 }
|
|
|
|
|
|
Return the ID of the "owner" thread.
Definition at line 592 of file Reactor.i. References ACE_thread_t, implementation, owner, and ACE_Reactor_Impl::owner.
00593 {
00594 return this->implementation ()->owner (owner);
00595 }
|
|
||||||||||||
|
Transfers ownership of Reactor to the <new_owner>.
Definition at line 584 of file Reactor.i. References ACE_thread_t, implementation, and ACE_Reactor_Impl::owner. Referenced by owner, and ACE_Asynch_Pseudo_Task::svc.
00586 {
00587 return this->implementation ()->owner (new_owner,
00588 old_owner);
00589 }
|
|
||||||||||||
|
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. Definition at line 541 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::purge_pending_notifications. Referenced by ACE_Event_Handler::~ACE_Event_Handler.
00543 {
00544 return this->implementation ()->purge_pending_notifications (eh, mask);
00545 }
|
|
|
Indicate if the Reactor's event loop has been ended.
Definition at line 108 of file Reactor.i. References ACE_TRACE, ACE_Reactor_Impl::deactivated, and implementation_. Referenced by event_loop_done, run_alertable_reactor_event_loop, and run_reactor_event_loop.
00109 {
00110 ACE_TRACE ("ACE_Reactor::reactor_event_loop_done");
00111 return this->implementation_->deactivated ();
00112 }
|
|
||||||||||||||||
|
GET/SET/ADD/CLR the ready "bit" bound with the <handle> and <mask>.
Definition at line 653 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::ready_ops.
00656 {
00657 return this->implementation ()->ready_ops (handle,
00658 mask,
00659 ops);
00660 }
|
|
||||||||||||||||
|
GET/SET/ADD/CLR the ready "bit" bound with the <event_handler> and <mask>.
Definition at line 643 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::ready_ops.
00646 {
00647 return this->implementation ()->ready_ops (event_handler,
00648 mask,
00649 ops);
00650 }
|
|
||||||||||||||||
|
Registers <new_sh> to handle a set of signals <sigset> using the <new_disp>.
Definition at line 316 of file Reactor.i. References implementation, and ACE_Reactor_Impl::register_handler.
00319 {
00320 return this->implementation ()->register_handler (sigset,
00321 new_sh,
00322 new_disp);
00323 }
|
|
||||||||||||||||||||||||
|
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. Definition at line 302 of file Reactor.i. References implementation, and ACE_Reactor_Impl::register_handler.
00307 {
00308 return this->implementation ()->register_handler (signum,
00309 new_sh,
00310 new_disp,
00311 old_sh,
00312 old_disp);
00313 }
|
|
||||||||||||||||
|
Register <event_handler> with all the <handles> in the <Handle_Set>.
Definition at line 281 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::register_handler.
00284 {
00285 // Remember the old reactor.
00286 ACE_Reactor *old_reactor = event_handler->reactor ();
00287
00288 // Assign *this* <Reactor> to the <Event_Handler>.
00289 event_handler->reactor (this);
00290
00291 int result = this->implementation ()->register_handler (handles,
00292 event_handler,
00293 mask);
00294 if (result == -1)
00295 // Reset the old reactor in case of failures.
00296 event_handler->reactor (old_reactor);
00297
00298 return result;
00299 }
|
|
||||||||||||||||||||
|
Register an <event_handler> that will be notified when <event_handle> is signaled. <mask> specifies the network events that the <event_handler> is interested in. Definition at line 258 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::register_handler.
00262 {
00263 // Remember the old reactor.
00264 ACE_Reactor *old_reactor = event_handler->reactor ();
00265
00266 // Assign *this* <Reactor> to the <Event_Handler>.
00267 event_handler->reactor (this);
00268
00269 int result = this->implementation ()->register_handler (event_handle,
00270 io_handle,
00271 event_handler,
00272 mask);
00273 if (result == -1)
00274 // Reset the old reactor in case of failures.
00275 event_handler->reactor (old_reactor);
00276
00277 return result;
00278 }
|
|
||||||||||||
|
Register an <event_handler> that will be notified when <event_handle> is signaled. Since no event mask is passed through this interface, it is assumed that the <event_handle> being passed in is an event handle and not an I/O handle. Originally this interface was available for all platforms, but because ACE_HANDLE is an int on non-Win32 platforms, 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). Therefore, we have restricted this method to Win32 only. Definition at line 237 of file Reactor.i. References implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::register_handler.
00239 {
00240 // Remember the old reactor.
00241 ACE_Reactor *old_reactor = event_handler->reactor ();
00242
00243 // Assign *this* <Reactor> to the <Event_Handler>.
00244 event_handler->reactor (this);
00245
00246 int result = this->implementation ()->register_handler (event_handler,
00247 event_handle);
00248 if (result == -1)
00249 // Reset the old reactor in case of failures.
00250 event_handler->reactor (old_reactor);
00251
00252 return result;
00253 }
|
|
||||||||||||||||
|
Register <event_handler> with <mask>. The I/O handle is provided through the <io_handle> parameter.
Definition at line 214 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::register_handler.
00217 {
00218 // Remember the old reactor.
00219 ACE_Reactor *old_reactor = event_handler->reactor ();
00220
00221 // Assign *this* <Reactor> to the <Event_Handler>.
00222 event_handler->reactor (this);
00223
00224 int result = this->implementation ()->register_handler (io_handle,
00225 event_handler,
00226 mask);
00227 if (result == -1)
00228 // Reset the old reactor in case of failures.
00229 event_handler->reactor (old_reactor);
00230
00231 return result;
00232 }
|
|
||||||||||||
|
Register <event_handler> with <mask>. The I/O handle will always come from <get_handle> on the <event_handler>.
Definition at line 195 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::register_handler. Referenced by ACE_Reactive_Strategy::activate_svc_handler, ACE_Process_Manager::append_proc, ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::create_AST, 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, ACE_Asynch_Pseudo_Task::register_io_handler, and ACE_Event_Handler::register_stdin_handler.
00197 {
00198 // Remember the old reactor.
00199 ACE_Reactor *old_reactor = event_handler->reactor ();
00200
00201 // Assign *this* <Reactor> to the <Event_Handler>.
00202 event_handler->reactor (this);
00203
00204 int result = this->implementation ()->register_handler (event_handler,
00205 mask);
00206 if (result == -1)
00207 // Reset the old reactor in case of failures.
00208 event_handler->reactor (old_reactor);
00209
00210 return result;
00211 }
|
|
|
Calls <remove_handler> for every signal in <sigset>.
Definition at line 362 of file Reactor.i. References implementation, and ACE_Reactor_Impl::remove_handler.
00363 {
00364 return this->implementation ()->remove_handler (sigset);
00365 }
|
|
||||||||||||||||||||
|
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). Returns 0 on success and -1 if <signum> is invalid. Definition at line 350 of file Reactor.i. References implementation, and ACE_Reactor_Impl::remove_handler.
00354 {
00355 return this->implementation ()->remove_handler (signum,
00356 new_disp,
00357 old_disp,
00358 sigkey);
00359 }
|
|
||||||||||||
|
Removes all handles in <handle_set>. If <mask> == <ACE_Event_Handler::DONT_CALL> then the <handle_close> method of the associated <event_handler>s is not invoked. Definition at line 342 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::remove_handler.
00344 {
00345 return this->implementation ()->remove_handler (handle_set,
00346 mask);
00347 }
|
|
||||||||||||
|
Removes the <ACE_Event_Handler> associated with <handle>. If <mask> includes <ACE_Event_Handler::DONT_CALL> then the <handle_close> method of the associated <event_handler> is not invoked. Definition at line 334 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::remove_handler.
00336 {
00337 return this->implementation ()->remove_handler (handle,
00338 mask);
00339 }
|
|
||||||||||||
|
|
Get position of the owner thread.
Definition at line 616 of file Reactor.i. References implementation, and ACE_Reactor_Impl::requeue_position.
00617 {
00618 return this->implementation ()->requeue_position ();
00619 }
|
|
|
Set position of the owner thread.
Definition at line 610 of file Reactor.i. References implementation, and ACE_Reactor_Impl::requeue_position.
00611 {
00612 this->implementation ()->requeue_position (position);
00613 }
|
|
|
Resets the <ACE_Reactor::end_event_loop_> static so that the <run_event_loop> 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>.
Definition at line 91 of file Reactor.i. References ACE_TRACE, instance, and reset_reactor_event_loop.
00092 {
00093 ACE_TRACE ("ACE_Reactor::reset_event_loop");
00094
00095 ACE_Reactor::instance ()->reset_reactor_event_loop ();
00096 }
|
|
|
Resets the <ACE_Reactor::end_event_loop_> static so that the <run_event_loop> method can be restarted.
Definition at line 289 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::deactivate, and implementation_. Referenced by reset_event_loop.
00290 {
00291 ACE_TRACE ("ACE_Reactor::reset_reactor_event_loop");
00292
00293 this->implementation_->deactivate (0);
00294 }
|
|
||||||||||||
|
Resets the interval of the timer represented by <timer_id> to <interval>, which is specified in relative time to the current <gettimeofday>. If <interval> is equal to <ACE_Time_Value::zero>, the timer will become a non-rescheduling timer. Returns 0 if successful, -1 if not. Definition at line 419 of file Reactor.i. References ACE_TRACE.
00421 {
00422 ACE_TRACE ("ACE_Reactor::reset_timer_interval");
00423
00424 return this->implementation ()->reset_timer_interval
00425 (timer_id,
00426 interval);
00427 }
|
|
|
Set a new value for restart and return the original value.
Definition at line 604 of file Reactor.i. References implementation, and ACE_Reactor_Impl::restart.
00605 {
00606 return this->implementation ()->restart (r);
00607 }
|
|
|
Get the existing restart value.
Definition at line 598 of file Reactor.i. References implementation, and ACE_Reactor_Impl::restart. Referenced by open.
00599 {
00600 return this->implementation ()->restart ();
00601 }
|
|
|
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 298 of file Reactor.cpp. References implementation, and ACE_Reactor_Impl::resumable_handler.
00299 {
00300 return this->implementation ()->resumable_handler ();
00301 }
|
|
|
Resume all <handles> in handle set.
Definition at line 405 of file Reactor.i. References implementation, and ACE_Reactor_Impl::resume_handler.
00406 {
00407 return this->implementation ()->resume_handler (handles);
00408 }
|
|
|
Resume <handle>.
Definition at line 399 of file Reactor.i. References implementation, and ACE_Reactor_Impl::resume_handler.
00400 {
00401 return this->implementation ()->resume_handler (handle);
00402 }
|
|
|
Resume <event_handler>. Use <ACE_Event_Handler::get_handle> to get the handle.
Definition at line 393 of file Reactor.i. References implementation, and ACE_Reactor_Impl::resume_handler. Referenced by ACE_Service_Manager::resume, ACE_Oneshot_Acceptor::resume, ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::resume, and ACE_Asynch_Pseudo_Task::resume_io_handler.
00394 {
00395 return this->implementation ()->resume_handler (event_handler);
00396 }
|
|
|
Resume all <handles>.
Definition at line 411 of file Reactor.i. References implementation, and ACE_Reactor_Impl::resume_handlers. Referenced by ACE_Schedule_All_Reactive_Strategy::resume.
00412 {
00413 return this->implementation ()->resume_handlers ();
00414 }
|
|
|
Definition at line 78 of file Reactor.i. References ACE_TRACE, check_reconfiguration, instance, and run_alertable_reactor_event_loop.
00079 {
00080 ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00081 ACE_Reactor *r = ACE_Reactor::instance ();
00082
00083 if (r == 0)
00084 return -1;
00085
00086 return r->run_alertable_reactor_event_loop
00087 (tv, ACE_Reactor::check_reconfiguration);
00088 }
|
|
|
Definition at line 62 of file Reactor.i. References ACE_TRACE, check_reconfiguration, instance, and run_alertable_reactor_event_loop.
00063 {
00064 ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00065 ACE_Reactor *r = ACE_Reactor::instance ();
00066
00067 if (r == 0)
00068 return -1;
00069
00070 return r->run_alertable_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00071 }
|
|
||||||||||||
|
Definition at line 255 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::alertable_handle_events, ACE_Reactor_Impl::deactivated, implementation_, and reactor_event_loop_done.
00257 {
00258 ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
00259
00260 if (this->reactor_event_loop_done ())
00261 return 0;
00262
00263 for (;;)
00264 {
00265 int result = this->implementation_->alertable_handle_events (tv);
00266
00267 if (eh != 0 && (*eh)(this))
00268 continue;
00269 else if (result == -1 && this->implementation_->deactivated ())
00270 return 0;
00271 else if (result <= 0)
00272 return result;
00273 }
00274
00275 ACE_NOTREACHED (return 0;)
00276 }
|
|
|
Definition at line 190 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::alertable_handle_events, ACE_Reactor_Impl::deactivated, implementation_, and reactor_event_loop_done. Referenced by run_alertable_event_loop.
00191 {
00192 ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
00193
00194 if (this->reactor_event_loop_done ())
00195 return 0;
00196
00197 while (1)
00198 {
00199 int result = this->implementation_->alertable_handle_events ();
00200
00201 if (eh != 0 && (*eh)(this))
00202 continue;
00203 else if (result == -1 && this->implementation_->deactivated ())
00204 return 0;
00205 else if (result == -1)
00206 return -1;
00207 }
00208
00209 ACE_NOTREACHED (return 0;)
00210 }
|
|
|
Run the event loop until the <ACE_Reactor::handle_events> or <ACE_Reactor::alertable_handle_events> methods returns -1, the <end_event_loop> 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>.
Definition at line 46 of file Reactor.i. References ACE_TRACE, check_reconfiguration, instance, and run_reactor_event_loop.
00047 {
00048 ACE_TRACE ("ACE_Reactor::run_event_loop");
00049 ACE_Reactor *r = ACE_Reactor::instance ();
00050
00051 if (r == 0)
00052 return -1;
00053
00054 return r->run_reactor_event_loop
00055 (tv, ACE_Reactor::check_reconfiguration);
00056 }
|
|
|
Run the event loop until the <ACE_Reactor::handle_events/ACE_Reactor::alertable_handle_events> method returns -1 or the <end_event_loop> 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>.
Definition at line 30 of file Reactor.i. References ACE_TRACE, check_reconfiguration, instance, and run_reactor_event_loop.
00031 {
00032 ACE_TRACE ("ACE_Reactor::run_event_loop");
00033 ACE_Reactor *r = ACE_Reactor::instance ();
00034
00035 if (r == 0)
00036 return -1;
00037
00038 return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00039 }
|
|
||||||||||||
|
Run the event loop until the <ACE_Reactor::handle_events> or <ACE_Reactor::alertable_handle_events> methods returns -1, the <end_reactor_event_loop> method is invoked, or the <ACE_Time_Value> expires. Definition at line 213 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::deactivated, ACE_Reactor_Impl::handle_events, implementation_, reactor_event_loop_done, and ACE_Time_Value::usec.
00215 {
00216 ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
00217
00218 if (this->reactor_event_loop_done ())
00219 return 0;
00220
00221 while (1)
00222 {
00223 int result = this->implementation_->handle_events (tv);
00224
00225 if (eh != 0 && (*eh) (this))
00226 continue;
00227 else if (result == -1)
00228 {
00229 if (this->implementation_->deactivated ())
00230 result = 0;
00231 return result;
00232 }
00233 else if (result == 0)
00234 {
00235 // The <handle_events> method timed out without dispatching
00236 // anything. Because of rounding and conversion errors and
00237 // such, it could be that the wait loop (WFMO, select, etc.)
00238 // timed out, but the timer queue said it wasn't quite ready
00239 // to expire a timer. In this case, the ACE_Time_Value we
00240 // passed into handle_events won't have quite been reduced
00241 // to 0, and we need to go around again. If we are all the
00242 // way to 0, just return, as the entire time the caller
00243 // wanted to wait has been used up.
00244 if (tv.usec () > 0)
00245 continue;
00246 return 0;
00247 }
00248 // Else there were some events dispatched; go around again
00249 }
00250
00251 ACE_NOTREACHED (return 0;)
00252 }
|
|
|
Run the event loop until the <ACE_Reactor::handle_events/ACE_Reactor::alertable_handle_events> method returns -1 or the <end_reactor_event_loop> method is invoked. Definition at line 167 of file Reactor.cpp. References ACE_TRACE, ACE_Reactor_Impl::deactivated, ACE_Reactor_Impl::handle_events, implementation_, and reactor_event_loop_done. Referenced by run_event_loop, and ACE_Asynch_Pseudo_Task::svc.
00168 {
00169 ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
00170
00171 if (this->reactor_event_loop_done ())
00172 return 0;
00173
00174 while (1)
00175 {
00176 int result = this->implementation_->handle_events ();
00177
00178 if (eh != 0 && (*eh)(this))
00179 continue;
00180 else if (result == -1 && this->implementation_->deactivated ())
00181 return 0;
00182 else if (result == -1)
00183 return -1;
00184 }
00185
00186 ACE_NOTREACHED (return 0;)
00187 }
|
|
||||||||||||||||||||
|
Schedule an ACE_Event_Handler that will expire after an amount of time. The return value of this method, a timer_id value, uniquely identifies the event_handler 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.
Definition at line 430 of file Reactor.i. References implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::schedule_timer. Referenced by ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::create_AST, and ACE_Logging_Strategy::init.
00434 {
00435 // Remember the old reactor.
00436 ACE_Reactor *old_reactor = event_handler->reactor ();
00437
00438 // Assign *this* <Reactor> to the <Event_Handler>.
00439 event_handler->reactor (this);
00440
00441 int result = this->implementation ()->schedule_timer (event_handler,
00442 arg,
00443 delta,
00444 interval);
00445 if (result == -1)
00446 // Reset the old reactor in case of failures.
00447 event_handler->reactor (old_reactor);
00448
00449 return result;
00450 }
|
|
||||||||||||
|
Add <masks_to_be_added> to the <handle>'s entry. <event_handler> 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 490 of file Reactor.i. References ACE_Reactor_Mask, implementation, and ACE_Reactor_Impl::schedule_wakeup.
00492 {
00493 return implementation ()->schedule_wakeup (handle,
00494 masks_to_be_added);
00495 }
|
|
||||||||||||
|
Add <masks_to_be_added> to the <event_handler>'s entry. <event_handler> 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 471 of file Reactor.i. References ACE_Reactor_Mask, implementation, ACE_Event_Handler::reactor, and ACE_Reactor_Impl::schedule_wakeup.
00473 {
00474 // Remember the old reactor.
00475 ACE_Reactor *old_reactor = event_handler->reactor ();
00476
00477 // Assign *this* <Reactor> to the <Event_Handler>.
00478 event_handler->reactor (this);
00479
00480 int result = this->implementation ()->schedule_wakeup (event_handler,
00481 masks_to_be_added);
00482 if (result == -1)
00483 // Reset the old reactor in case of failures.
00484 event_handler->reactor (old_reactor);
00485
00486 return result;
00487 }
|
|
|
Use a user specified signal handler instead.
Definition at line 133 of file Reactor.i. References implementation, and ACE_Reactor_Impl::set_sig_handler.
00134 {
00135 return this->implementation ()->set_sig_handler (signal_handler);
00136 }
|
|
|
Definition at line 145 of file Reactor.i. References timer_queue.
00146 {
00147 return this->timer_queue (tq);
00148 }
|
|
|
Returns the current size of the Reactor's internal descriptor table.
Definition at line 663 of file Reactor.i. References implementation, and ACE_Reactor_Impl::size. Referenced by current_info, and open.
00664 {
00665 return this->implementation ()->size ();
00666 }
|
|
|
Suspend all <handles> in handle set temporarily.
Definition at line 381 of file Reactor.i. References implementation, and ACE_Reactor_Impl::suspend_handler.
00382 {
00383 return this->implementation ()->suspend_handler (handles);
00384 }
|
|
|
Suspend <handle> temporarily.
Definition at line 375 of file Reactor.i. References implementation, and ACE_Reactor_Impl::suspend_handler.
00376 {
00377 return this->implementation ()->suspend_handler (handle);
00378 }
|
|
|
Suspend <event_handler> temporarily. Use <ACE_Event_Handler::get_handle> to get the handle.
Definition at line 369 of file Reactor.i. References implementation, and ACE_Reactor_Impl::suspend_handler. Referenced by ACE_Asynch_Pseudo_Task::register_io_handler, ACE_Service_Manager::suspend, ACE_Oneshot_Acceptor::suspend, ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::suspend, and ACE_Asynch_Pseudo_Task::suspend_io_handler.
00370 {
00371 return this->implementation ()->suspend_handler (event_handler);
00372 }
|
|
|
Suspend all <handles> temporarily.
Definition at line 387 of file Reactor.i. References implementation, and ACE_Reactor_Impl::suspend_handlers. Referenced by ACE_Schedule_All_Reactive_Strategy::suspend.
00388 {
00389 return this->implementation ()->suspend_handlers ();
00390 }
|
|
|
Return the current <ACE_Timer_Queue>.
Definition at line 151 of file Reactor.i. References implementation_, and ACE_Reactor_Impl::timer_queue. Referenced by set_timer_queue.
00152 {
00153 ACE_Reactor_Impl *impl = this->implementation_;
00154 return impl->timer_queue ();
00155 }
|
|
|
Set a user-specified timer queue.
Definition at line 139 of file Reactor.i. References implementation, and ACE_Reactor_Impl::timer_queue.
00140 {
00141 return this->implementation ()->timer_queue (tq);
00142 }
|
|
|
Return 1 if we any event associations were made by the reactor for the handles that it waits on, 0 otherwise.
Definition at line 669 of file Reactor.i. References implementation, and ACE_Reactor_Impl::uses_event_associations. Referenced by ACE_Reactive_Strategy::activate_svc_handler, ACE_Service_Manager::handle_input, ACE_Oneshot_Acceptor::handle_input, and ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::handle_output.
00670 {
00671 return this->implementation ()->uses_event_associations ();
00672 }
|
|
|
Wake up all threads in waiting in the event loop.
Definition at line 578 of file Reactor.i. References implementation, and ACE_Reactor_Impl::wakeup_all_threads.
00579 {
00580 this->implementation ()->wakeup_all_threads ();
00581 }
|
|
|
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 164 of file Reactor.i. References implementation, and ACE_Reactor_Impl::work_pending.
00165 {
00166 return this->implementation ()->work_pending (max_wait_time);
00167 }
|
|
|
Declare the dynamic allocation hooks.
|
|
|
Flag used to indicate whether we are responsible for cleaning up the implementation instance.
Definition at line 685 of file Reactor.h. Referenced by ACE_Reactor, and ~ACE_Reactor. |
|
|
Must delete the <reactor_> singleton if non-0.
Definition at line 74 of file Reactor.cpp. Referenced by close_singleton, and instance. |
|
|
Delegation/implementation class that all methods will be forwarded to.
Definition at line 681 of file Reactor.h. Referenced by dump, end_reactor_event_loop, implementation, reactor_event_loop_done, reset_reactor_event_loop, run_alertable_reactor_event_loop, run_reactor_event_loop, and timer_queue. |
|
|
Pointer to a process-wide <ACE_Reactor> singleton.
Definition at line 70 of file Reactor.cpp. Referenced by close_singleton, and instance. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002