Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Select_Reactor_T.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Select_Reactor_T.i,v 1.1.1.3 2003/02/21 18:36:32 chad Exp $
00003 
00004 #include "ace/Reactor.h"
00005 
00006 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00007 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (ACE_Event_Handler *h)
00008 {
00009   ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
00010   return this->resume_handler (h->get_handle ());
00011 }
00012 
00013 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00014 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle_Set &handles)
00015 {
00016   ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
00017   ACE_Handle_Set_Iterator handle_iter (handles);
00018   ACE_HANDLE h;
00019 
00020   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00021 
00022   while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
00023     if (this->resume_i (h) == -1)
00024       return -1;
00025 
00026   return 0;
00027 }
00028 
00029 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00030 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (ACE_Event_Handler *h)
00031 {
00032   ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
00033   return this->suspend_handler (h->get_handle ());
00034 }
00035 
00036 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00037 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handle_Set &handles)
00038 {
00039   ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
00040   ACE_Handle_Set_Iterator handle_iter (handles);
00041   ACE_HANDLE h;
00042 
00043   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00044 
00045   while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
00046     if (this->suspend_i (h) == -1)
00047       return -1;
00048 
00049   return 0;
00050 }
00051 
00052 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00053 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum,
00054                                                                   ACE_Event_Handler *new_sh,
00055                                                                   ACE_Sig_Action *new_disp,
00056                                                                   ACE_Event_Handler **old_sh,
00057                                                                   ACE_Sig_Action *old_disp)
00058 {
00059   ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
00060   return this->signal_handler_->register_handler (signum,
00061                                                   new_sh, new_disp,
00062                                                   old_sh, old_disp);
00063 }
00064 
00065 #if defined (ACE_WIN32)
00066 
00067 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00068 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Handler *event_handler,
00069                                                                   ACE_HANDLE event_handle)
00070 {
00071   // Don't have an implementation for this yet...
00072   ACE_UNUSED_ARG (event_handler);
00073   ACE_UNUSED_ARG (event_handle);
00074   ACE_NOTSUP_RETURN (-1);
00075 }
00076 
00077 #endif /* ACE_WIN32 */
00078 
00079 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00080 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE event_handle,
00081                                                                   ACE_HANDLE io_handle,
00082                                                                   ACE_Event_Handler *event_handler,
00083                                                                   ACE_Reactor_Mask mask)
00084 {
00085   // Don't have an implementation for this yet...
00086   ACE_UNUSED_ARG (event_handle);
00087   ACE_UNUSED_ARG (io_handle);
00088   ACE_UNUSED_ARG (event_handler);
00089   ACE_UNUSED_ARG (mask);
00090   ACE_NOTSUP_RETURN (-1);
00091 }
00092 
00093 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00094 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (int signum, ACE_Event_Handler **handler)
00095 {
00096   ACE_TRACE ("ACE_Select_Reactor_T::handler");
00097   return this->handler_i (signum, handler);
00098 }
00099 
00100 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00101 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum,
00102                                                                 ACE_Sig_Action *new_disp,
00103                                                                 ACE_Sig_Action *old_disp,
00104                                                                 int sigkey)
00105 {
00106   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00107   return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey);
00108 }
00109 
00110 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00111 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void)
00112 {
00113   // Since the Select_Reactor does not do any event associations, this
00114   // function always return 0.
00115   return 0;
00116 }
00117 
00118 // = The remaining methods in this file must be called with locks
00119 // held.
00120 
00121 // Performs operations on the "ready" bits.
00122 
00123 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00124 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *handler,
00125                                                            ACE_Reactor_Mask mask,
00126                                                            int ops)
00127 {
00128   ACE_TRACE ("ACE_Select_Reactor_T::ready_ops");
00129   return this->ready_ops (handler->get_handle (), mask, ops);
00130 }
00131 
00132 // Performs operations on the "dispatch" masks.
00133 
00134 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00135 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *handler,
00136                                                           ACE_Reactor_Mask mask,
00137                                                           int ops)
00138 {
00139   ACE_TRACE ("ACE_Select_Reactor_T::mask_ops");
00140   return this->mask_ops (handler->get_handle (), mask, ops);
00141 }
00142 
00143 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00144 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handler *eh,
00145                                                                  ACE_Reactor_Mask mask)
00146 {
00147   ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
00148   return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK);
00149 }
00150 
00151 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00152 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler *eh,
00153                                                                ACE_Reactor_Mask mask)
00154 {
00155   ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
00156   return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK);
00157 }
00158 
00159 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00160 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE handle,
00161                                                                  ACE_Reactor_Mask mask)
00162 {
00163   ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
00164   return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK);
00165 }
00166 
00167 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00168 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle,
00169                                                                ACE_Reactor_Mask mask)
00170 {
00171   ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
00172   return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK);
00173 }
00174 
00175 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ ACE_Lock &
00176 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::lock (void)
00177 {
00178   ACE_TRACE ("ACE_Select_Reactor_T::lock");
00179   return this->lock_adapter_;
00180 }
00181 
00182 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void
00183 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void)
00184 {
00185   // Send a notification, but don't block if there's no one to receive
00186   // it.
00187   this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero);
00188 }
00189 
00190 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00191 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value *max_wait_time)
00192 {
00193   return this->handle_events (max_wait_time);
00194 }
00195 
00196 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00197 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value &max_wait_time)
00198 {
00199   return this->handle_events (max_wait_time);
00200 }
00201 
00202 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
00203 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivated (void)
00204 {
00205   return this->deactivated_;
00206 }
00207 
00208 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void
00209 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop)
00210 {
00211   this->deactivated_ = do_stop;
00212   this->wakeup_all_threads ();
00213 }
00214 
00215 template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ size_t
00216 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void) const
00217 {
00218   return this->handler_rep_.size ();
00219 }

Generated on Mon Jun 16 11:21:10 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002