Reactor.cpp

Go to the documentation of this file.
00001 // Reactor.cpp,v 4.130 2006/04/19 19:13:09 jwillemsen Exp
00002 
00003 #include "ace/Reactor.h"
00004 
00005 //#if !defined (ACE_HAS_WINCE)
00006 #  if !defined (ACE_LACKS_ACE_SVCCONF)
00007 #    include "ace/Service_Config.h"
00008 #  endif /* !ACE_LACKS_ACE_SVCCONF */
00009 //#endif /* ! ACE_HAS_WINCE */
00010 
00011 /*
00012  * Hook to specialize the includes directly with the concrete
00013  * Reactor type, e.g., select, thread pool reactor
00014  * known at compile time. This hook results in all the
00015  * #defines being commented
00016  * out and the concrete header file directly included.
00017  */
00018 //@@ REACTOR_SPL_COMMENT_INCLUDE_START_HOOK
00019 // Only include the headers needed to compile.
00020 #if !defined (ACE_WIN32) \
00021       || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \
00022       || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \
00023       || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) \
00024       || defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL)
00025 #  if defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL)
00026 #    include "ace/TP_Reactor.h"
00027 #  else
00028 #    if defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL)
00029 #      include "ace/Dev_Poll_Reactor.h"
00030 #    else
00031 #      include "ace/Select_Reactor.h"
00032 #    endif /* ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL */
00033 #  endif /* ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL */
00034 #else /* We are on Win32 and we have winsock and ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL is not defined */
00035 #  if defined (ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL)
00036 #    include "ace/Msg_WFMO_Reactor.h"
00037 #  else
00038 #    include "ace/WFMO_Reactor.h"
00039 #  endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */
00040 #endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */
00041 
00042 /*
00043  * End comment hook.
00044  */
00045 //@@ REACTOR_SPL_COMMENT_INCLUDE_END_HOOK
00046 
00047 #include "ace/Static_Object_Lock.h"
00048 #include "ace/Framework_Component.h"
00049 #include "ace/Guard_T.h"
00050 #include "ace/Recursive_Thread_Mutex.h"
00051 
00052 #if !defined (__ACE_INLINE__)
00053 #include "ace/Reactor.inl"
00054 #endif /* __ACE_INLINE__ */
00055 
00056 
00057 ACE_RCSID (ace,
00058            Reactor,
00059            "Reactor.cpp,v 4.130 2006/04/19 19:13:09 jwillemsen Exp")
00060 
00061 
00062 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00063 
00064 ACE_ALLOC_HOOK_DEFINE(ACE_Reactor)
00065 
00066 ACE_Reactor::ACE_Reactor (ACE_Reactor_Impl *impl,
00067                           int delete_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 }
00118 
00119 ACE_Reactor::~ACE_Reactor (void)
00120 {
00121   this->implementation ()->close ();
00122   if (this->delete_implementation_)
00123     delete this->implementation ();
00124 }
00125 
00126 // Process-wide ACE_Reactor.
00127 ACE_Reactor *ACE_Reactor::reactor_ = 0;
00128 
00129 // Controls whether the Reactor is deleted when we shut down (we can
00130 // only delete it safely if we created it!)
00131 int ACE_Reactor::delete_reactor_ = 0;
00132 
00133 ACE_Reactor *
00134 ACE_Reactor::instance (void)
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 }
00155 
00156 ACE_Reactor *
00157 ACE_Reactor::instance (ACE_Reactor *r,
00158                        int delete_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 }
00181 
00182 void
00183 ACE_Reactor::close_singleton (void)
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 }
00197 
00198 const ACE_TCHAR *
00199 ACE_Reactor::dll_name (void)
00200 {
00201   return ACE_LIB_TEXT ("ACE");
00202 }
00203 
00204 const ACE_TCHAR *
00205 ACE_Reactor::name (void)
00206 {
00207   return ACE_LIB_TEXT ("ACE_Reactor");
00208 }
00209 
00210 int
00211 ACE_Reactor::check_reconfiguration (ACE_Reactor *)
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 }
00222 
00223 int
00224 ACE_Reactor::run_reactor_event_loop (REACTOR_EVENT_HOOK eh)
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 }
00245 
00246 int
00247 ACE_Reactor::run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK eh)
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 }
00268 
00269 int
00270 ACE_Reactor::run_reactor_event_loop (ACE_Time_Value &tv,
00271                                      REACTOR_EVENT_HOOK eh)
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 }
00310 
00311 int
00312 ACE_Reactor::run_alertable_reactor_event_loop (ACE_Time_Value &tv,
00313                                                REACTOR_EVENT_HOOK eh)
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 }
00332 
00333 int
00334 ACE_Reactor::end_reactor_event_loop (void)
00335 {
00336   ACE_TRACE ("ACE_Reactor::end_reactor_event_loop");
00337 
00338   this->implementation_->deactivate (1);
00339 
00340   return 0;
00341 }
00342 
00343 void
00344 ACE_Reactor::reset_reactor_event_loop (void)
00345 {
00346   ACE_TRACE ("ACE_Reactor::reset_reactor_event_loop");
00347 
00348   this->implementation_->deactivate (0);
00349 }
00350 
00351 int
00352 ACE_Reactor::resumable_handler (void)
00353 {
00354   return this->implementation ()->resumable_handler ();
00355 }
00356 
00357 ACE_Reactor_Impl *
00358 ACE_Reactor::implementation (void) const
00359 {
00360   return this->implementation_;
00361 }
00362 
00363 void
00364 ACE_Reactor::implementation (ACE_Reactor_Impl *impl)
00365 {
00366   this->implementation_ = impl;
00367 }
00368 
00369 int
00370 ACE_Reactor::current_info (ACE_HANDLE handle,
00371                            size_t &size)
00372 {
00373   return this->implementation ()->current_info (handle, size);
00374 }
00375 
00376 int
00377 ACE_Reactor::open (size_t size,
00378                    int restart,
00379                    ACE_Sig_Handler *signal_handler,
00380                    ACE_Timer_Queue *timer_queue)
00381 {
00382   return this->implementation ()->open (size,
00383                                         restart,
00384                                         signal_handler,
00385                                         timer_queue);
00386 }
00387 int
00388 ACE_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
00389 {
00390   return this->implementation ()->set_sig_handler (signal_handler);
00391 }
00392 
00393 int
00394 ACE_Reactor::timer_queue (ACE_Timer_Queue *tq)
00395 {
00396   return this->implementation ()->timer_queue (tq);
00397 }
00398 
00399 ACE_Timer_Queue *
00400 ACE_Reactor::timer_queue (void) const
00401 {
00402   ACE_Reactor_Impl *impl = this->implementation_;
00403   return impl->timer_queue ();
00404 }
00405 
00406 int
00407 ACE_Reactor::close (void)
00408 {
00409   return this->implementation ()->close ();
00410 }
00411 
00412 int
00413 ACE_Reactor::work_pending (const ACE_Time_Value &max_wait_time)
00414 {
00415   return this->implementation ()->work_pending (max_wait_time);
00416 }
00417 
00418 int
00419 ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
00420 {
00421   return this->implementation ()->handle_events (max_wait_time);
00422 }
00423 
00424 int
00425 ACE_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time)
00426 {
00427   return this->implementation ()->alertable_handle_events (max_wait_time);
00428 }
00429 
00430 int
00431 ACE_Reactor::handle_events (ACE_Time_Value &max_wait_time)
00432 {
00433   return this->implementation ()->handle_events (max_wait_time);
00434 }
00435 
00436 int
00437 ACE_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time)
00438 {
00439   return this->implementation ()->alertable_handle_events (max_wait_time);
00440 }
00441 
00442 
00443 int
00444 ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
00445                                ACE_Reactor_Mask mask)
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 }
00461 
00462 int
00463 ACE_Reactor::register_handler (ACE_HANDLE io_handle,
00464                                ACE_Event_Handler *event_handler,
00465                                ACE_Reactor_Mask mask)
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 }
00482 
00483 #if defined (ACE_WIN32)
00484 
00485 int
00486 ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
00487                                ACE_HANDLE event_handle)
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 }
00503 
00504 #endif /* ACE_WIN32 */
00505 
00506 int
00507 ACE_Reactor::register_handler (ACE_HANDLE event_handle,
00508                                ACE_HANDLE io_handle,
00509                                ACE_Event_Handler *event_handler,
00510                                ACE_Reactor_Mask mask)
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 }
00528 
00529 int
00530 ACE_Reactor::register_handler (const ACE_Handle_Set &handles,
00531                                ACE_Event_Handler *event_handler,
00532                                ACE_Reactor_Mask mask)
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 }
00549 
00550 int
00551 ACE_Reactor::register_handler (int signum,
00552                                ACE_Event_Handler *new_sh,
00553                                ACE_Sig_Action *new_disp,
00554                                ACE_Event_Handler **old_sh,
00555                                ACE_Sig_Action *old_disp)
00556 {
00557   return this->implementation ()->register_handler (signum,
00558                                                     new_sh,
00559                                                     new_disp,
00560                                                     old_sh,
00561                                                     old_disp);
00562 }
00563 
00564 int
00565 ACE_Reactor::register_handler (const ACE_Sig_Set &sigset,
00566                                ACE_Event_Handler *new_sh,
00567                                ACE_Sig_Action *new_disp)
00568 {
00569   return this->implementation ()->register_handler (sigset,
00570                                                     new_sh,
00571                                                     new_disp);
00572 }
00573 
00574 int
00575 ACE_Reactor::remove_handler (ACE_Event_Handler *event_handler,
00576                              ACE_Reactor_Mask mask)
00577 {
00578   return this->implementation ()->remove_handler (event_handler,
00579                                                   mask);
00580 }
00581 
00582 int
00583 ACE_Reactor::remove_handler (ACE_HANDLE handle,
00584                              ACE_Reactor_Mask mask)
00585 {
00586   return this->implementation ()->remove_handler (handle,
00587                                                   mask);
00588 }
00589 
00590 int
00591 ACE_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
00592                              ACE_Reactor_Mask mask)
00593 {
00594   return this->implementation ()->remove_handler (handle_set,
00595                                                   mask);
00596 }
00597 
00598 int
00599 ACE_Reactor::remove_handler (int signum,
00600                              ACE_Sig_Action *new_disp,
00601                              ACE_Sig_Action *old_disp,
00602                              int sigkey)
00603 {
00604   return this->implementation ()->remove_handler (signum,
00605                                                   new_disp,
00606                                                   old_disp,
00607                                                   sigkey);
00608 }
00609 
00610 int
00611 ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset)
00612 {
00613   return this->implementation ()->remove_handler (sigset);
00614 }
00615 
00616 
00617 int
00618 ACE_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
00619 {
00620   return this->implementation ()->suspend_handler (event_handler);
00621 }
00622 
00623 int
00624 ACE_Reactor::suspend_handler (ACE_HANDLE handle)
00625 {
00626   return this->implementation ()->suspend_handler (handle);
00627 }
00628 
00629 int
00630 ACE_Reactor::suspend_handler (const ACE_Handle_Set &handles)
00631 {
00632   return this->implementation ()->suspend_handler (handles);
00633 }
00634 
00635 int
00636 ACE_Reactor::suspend_handlers (void)
00637 {
00638   return this->implementation ()->suspend_handlers ();
00639 }
00640 
00641 int
00642 ACE_Reactor::resume_handler (ACE_Event_Handler *event_handler)
00643 {
00644   return this->implementation ()->resume_handler (event_handler);
00645 }
00646 
00647 int
00648 ACE_Reactor::resume_handler (ACE_HANDLE handle)
00649 {
00650   return this->implementation ()->resume_handler (handle);
00651 }
00652 
00653 int
00654 ACE_Reactor::resume_handler (const ACE_Handle_Set &handles)
00655 {
00656   return this->implementation ()->resume_handler (handles);
00657 }
00658 
00659 int
00660 ACE_Reactor::resume_handlers (void)
00661 {
00662   return this->implementation ()->resume_handlers ();
00663 }
00664 
00665 
00666 int
00667 ACE_Reactor::reset_timer_interval
00668   (long timer_id,
00669    const ACE_Time_Value &interval)
00670 {
00671   ACE_TRACE ("ACE_Reactor::reset_timer_interval");
00672 
00673   return this->implementation ()->reset_timer_interval
00674     (timer_id,
00675      interval);
00676 }
00677 
00678 long
00679 ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
00680                              const void *arg,
00681                              const ACE_Time_Value &delta,
00682                              const ACE_Time_Value &interval)
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 }
00700 
00701 int
00702 ACE_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
00703                            int dont_call_handle_close)
00704 {
00705   return this->implementation ()->cancel_timer (event_handler,
00706                                                 dont_call_handle_close);
00707 }
00708 
00709 int
00710 ACE_Reactor::cancel_timer (long timer_id,
00711                            const void **arg,
00712                            int dont_call_handle_close)
00713 {
00714   return this->implementation ()->cancel_timer (timer_id,
00715                                                 arg,
00716                                                 dont_call_handle_close);
00717 }
00718 
00719 int
00720 ACE_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
00721                               ACE_Reactor_Mask masks_to_be_added)
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 }
00737 
00738 int
00739 ACE_Reactor::schedule_wakeup (ACE_HANDLE handle,
00740                               ACE_Reactor_Mask masks_to_be_added)
00741 {
00742   return implementation ()->schedule_wakeup (handle,
00743                                              masks_to_be_added);
00744 }
00745 
00746 int
00747 ACE_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
00748                             ACE_Reactor_Mask masks_to_be_cleared)
00749 {
00750   return this->implementation ()->cancel_wakeup (event_handler,
00751                                                  masks_to_be_cleared);
00752 }
00753 
00754 int
00755 ACE_Reactor::cancel_wakeup (ACE_HANDLE handle,
00756                             ACE_Reactor_Mask masks_to_be_cleared)
00757 {
00758   return this->implementation ()->cancel_wakeup (handle,
00759                                                  masks_to_be_cleared);
00760 }
00761 
00762 
00763 int
00764 ACE_Reactor::notify (ACE_Event_Handler *event_handler,
00765                      ACE_Reactor_Mask mask,
00766                      ACE_Time_Value *tv)
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 }
00776 
00777 void
00778 ACE_Reactor::max_notify_iterations (int iterations)
00779 {
00780   this->implementation ()->max_notify_iterations (iterations);
00781 }
00782 
00783 int
00784 ACE_Reactor::max_notify_iterations (void)
00785 {
00786   return this->implementation ()->max_notify_iterations ();
00787 }
00788 
00789 int
00790 ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
00791                                           ACE_Reactor_Mask   mask)
00792 {
00793   return this->implementation ()->purge_pending_notifications (eh, mask);
00794 }
00795 
00796 ACE_Event_Handler *
00797 ACE_Reactor::find_handler (ACE_HANDLE handle)
00798 {
00799   return this->implementation ()->find_handler (handle);
00800 }
00801 
00802 int
00803 ACE_Reactor::handler (ACE_HANDLE handle,
00804                       ACE_Reactor_Mask mask,
00805                       ACE_Event_Handler **event_handler)
00806 {
00807   return this->implementation ()->handler (handle,
00808                                            mask,
00809                                            event_handler);
00810 }
00811 
00812 int
00813 ACE_Reactor::handler (int signum,
00814                       ACE_Event_Handler **event_handler)
00815 {
00816   return this->implementation ()->handler (signum,
00817                                            event_handler);
00818 }
00819 
00820 int
00821 ACE_Reactor::initialized (void)
00822 {
00823   return this->implementation ()->initialized ();
00824 }
00825 
00826 ACE_Lock &
00827 ACE_Reactor::lock (void)
00828 {
00829   return this->implementation ()->lock ();
00830 }
00831 
00832 void
00833 ACE_Reactor::wakeup_all_threads (void)
00834 {
00835   this->implementation ()->wakeup_all_threads ();
00836 }
00837 
00838 int
00839 ACE_Reactor::owner (ACE_thread_t new_owner,
00840                     ACE_thread_t *old_owner)
00841 {
00842   return this->implementation ()->owner (new_owner,
00843                                          old_owner);
00844 }
00845 
00846 int
00847 ACE_Reactor::owner (ACE_thread_t *owner)
00848 {
00849   return this->implementation ()->owner (owner);
00850 }
00851 
00852 int
00853 ACE_Reactor::restart (void)
00854 {
00855   return this->implementation ()->restart ();
00856 }
00857 
00858 int
00859 ACE_Reactor::restart (int r)
00860 {
00861   return this->implementation ()->restart (r);
00862 }
00863 
00864 void
00865 ACE_Reactor::requeue_position (int position)
00866 {
00867   this->implementation ()->requeue_position (position);
00868 }
00869 
00870 int
00871 ACE_Reactor::requeue_position (void)
00872 {
00873   return this->implementation ()->requeue_position ();
00874 }
00875 
00876 
00877 int
00878 ACE_Reactor::mask_ops (ACE_Event_Handler *event_handler,
00879                        ACE_Reactor_Mask mask,
00880                        int ops)
00881 {
00882   return this->implementation ()->mask_ops (event_handler,
00883                                             mask,
00884                                             ops);
00885 }
00886 
00887 int
00888 ACE_Reactor::mask_ops (ACE_HANDLE handle,
00889                        ACE_Reactor_Mask mask,
00890                        int ops)
00891 {
00892   return this->implementation ()->mask_ops (handle,
00893                                             mask,
00894                                             ops);
00895 }
00896 
00897 int
00898 ACE_Reactor::ready_ops (ACE_Event_Handler *event_handler,
00899                         ACE_Reactor_Mask mask,
00900                         int ops)
00901 {
00902   return this->implementation ()->ready_ops (event_handler,
00903                                              mask,
00904                                              ops);
00905 }
00906 
00907 int
00908 ACE_Reactor::ready_ops (ACE_HANDLE handle,
00909                         ACE_Reactor_Mask mask,
00910                         int ops)
00911 {
00912   return this->implementation ()->ready_ops (handle,
00913                                              mask,
00914                                              ops);
00915 }
00916 
00917 int
00918 ACE_Reactor::reactor_event_loop_done (void)
00919 {
00920   ACE_TRACE ("ACE_Reactor::reactor_event_loop_done");
00921   return this->implementation_->deactivated ();
00922 }
00923 
00924 size_t
00925 ACE_Reactor::size (void) const
00926 {
00927   return this->implementation ()->size ();
00928 }
00929 
00930 int
00931 ACE_Reactor::uses_event_associations (void)
00932 {
00933   return this->implementation ()->uses_event_associations ();
00934 }
00935 
00936 void
00937 ACE_Reactor::dump (void) const
00938 {
00939 #if defined (ACE_HAS_DUMP)
00940   ACE_TRACE ("ACE_Reactor::dump");
00941 
00942   implementation_->dump ();
00943 #endif /* ACE_HAS_DUMP */
00944 }
00945 
00946 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:42:01 2006 for ACE by doxygen 1.3.6