Select_Reactor_Base.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: Select_Reactor_Base.inl 81138 2008-03-28 09:18:15Z johnnyw $
00004 
00005 #include "ace/Reactor.h"
00006 
00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 ACE_INLINE ACE_Select_Reactor_Handler_Repository::size_type
00010 ACE_Select_Reactor_Handler_Repository::size (void) const
00011 {
00012 #ifdef ACE_WIN32
00013   return this->event_handlers_.total_size ();
00014 #else
00015   return this->event_handlers_.size ();
00016 #endif  /* ACE_WIN32 */
00017 }
00018 
00019 ACE_INLINE ACE_Select_Reactor_Handler_Repository::max_handlep1_type
00020 ACE_Select_Reactor_Handler_Repository::max_handlep1 (void) const
00021 {
00022 #ifdef ACE_WIN32
00023   return this->event_handlers_.current_size ();
00024 #else
00025   return this->max_handlep1_;
00026 #endif  /* ACE_WIN32 */
00027 }
00028 
00029 ACE_INLINE int
00030 ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
00031                                                ACE_Reactor_Mask mask)
00032 {
00033   // Do not refactor this code to optimize the call to the unbind impl.
00034   // To resolve bug 2653, unbind must be called even when find_eh returns
00035   // event_handlers_.end().
00036 
00037   return !this->handle_in_range (handle) ? -1
00038           : this->unbind (handle,
00039                           this->find_eh (handle),
00040                           mask);
00041 }
00042 
00043 ACE_INLINE ACE_Event_Handler *
00044 ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle)
00045 {
00046   ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find");
00047 
00048   ACE_Event_Handler * eh = 0;
00049 
00050   if (this->handle_in_range (handle))
00051     {
00052       map_type::iterator const pos = this->find_eh (handle);
00053 
00054       if (pos != this->event_handlers_.end ())
00055         {
00056 #ifdef ACE_WIN32
00057           eh = (*pos).item ();
00058 #else
00059           eh = *pos;
00060 #endif  /* ACE_WIN32 */
00061         }
00062     }
00063   // Don't bother setting errno.  It isn't used in the select()-based
00064   // reactors and incurs a TSS access.
00065   //   else
00066   //     {
00067   //       errno = ENOENT;
00068   //     }
00069 
00070   return eh;
00071 }
00072 
00073 // ------------------------------------------------------------------
00074 
00075 ACE_INLINE bool
00076 ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const
00077 {
00078 #ifdef ACE_WIN32
00079   return this->current_ == this->rep_->event_handlers_.end ();
00080 #else
00081   return this->current_ == (this->rep_->event_handlers_.begin ()
00082                             + this->rep_->max_handlep1 ());
00083 #endif /* ACE_WIN32 */
00084 }
00085 
00086 // ------------------------------------------------------------------
00087 
00088 ACE_INLINE
00089 ACE_Event_Tuple::ACE_Event_Tuple (void)
00090   : handle_ (ACE_INVALID_HANDLE),
00091     event_handler_ (0)
00092 {
00093 }
00094 
00095 ACE_INLINE
00096 ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh,
00097                                   ACE_HANDLE h)
00098   : handle_ (h),
00099     event_handler_ (eh)
00100 {
00101 }
00102 
00103 ACE_INLINE bool
00104 ACE_Event_Tuple::operator== (const ACE_Event_Tuple &rhs) const
00105 {
00106   return this->handle_ == rhs.handle_;
00107 }
00108 
00109 ACE_INLINE bool
00110 ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const
00111 {
00112   return !(*this == rhs);
00113 }
00114 
00115 #if defined (ACE_WIN32_VC8) || defined (ACE_WIN32_VC9)
00116 #  pragma warning (push)
00117 #  pragma warning (disable:4355)  /* Use of 'this' in initializer list */
00118 #endif
00119 ACE_INLINE
00120 ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms)
00121   : handler_rep_ (*this)
00122   , timer_queue_ (0)
00123   , signal_handler_ (0)
00124   , notify_handler_ (0)
00125   , delete_timer_queue_ (false)
00126   , delete_signal_handler_ (false)
00127   , delete_notify_handler_ (false)
00128   , initialized_ (false)
00129   , restart_ (0)
00130   , requeue_position_ (-1) // Requeue at end of waiters by default.
00131   , state_changed_ (0)
00132   , mask_signals_ (ms)
00133   , supress_renew_ (0)
00134 {
00135 }
00136 #if defined (ACE_WIN32_VC8) || defined (ACE_WIN32_VC9)
00137 #  pragma warning (pop)
00138 #endif
00139 
00140 ACE_INLINE int
00141 ACE_Select_Reactor_Impl::supress_notify_renew (void)
00142 {
00143   return this->supress_renew_;
00144 }
00145 
00146 ACE_INLINE void
00147 ACE_Select_Reactor_Impl::supress_notify_renew (int sr)
00148 {
00149   this->supress_renew_ = sr;
00150 }
00151 
00152 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:42 2010 for ACE by  doxygen 1.4.7