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

ACE_Select_Reactor_Impl Class Reference

This class simply defines how Select_Reactor's basic interface functions should look like and provides a common base class for <Select_Reactor> using various locking mechanism. More...

#include <Select_Reactor_Base.h>

Inheritance diagram for ACE_Select_Reactor_Impl:

Inheritance graph
[legend]
Collaboration diagram for ACE_Select_Reactor_Impl:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE }

Public Methods

 ACE_Select_Reactor_Impl (void)
 Constructor. More...

virtual int purge_pending_notifications (ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK)
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. The select reactor has no handlers that can be resumed by the application. So return 0;. More...


Protected Methods

virtual int bit_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Select_Reactor_Handle_Set &wait_Set, int ops)
 Allow manipulation of the <wait_set_> mask and <ready_set_> mask. More...

virtual void renew (void)=0
 Enqueue ourselves into the list of waiting threads at the appropriate point specified by <requeue_position_>. More...

virtual int is_suspended_i (ACE_HANDLE handle)=0
 Check to see if the <Event_Handler> associated with <handle> is suspended. Returns 0 if not, 1 if so. More...

int supress_notify_renew (void)
 Controls/access whether the notify handler should renew the Select_Reactor's token or not. More...

void supress_notify_renew (int sr)

Protected Attributes

ACE_Select_Reactor_Handler_Repository handler_rep_
 Table that maps <ACE_HANDLEs> to <ACE_Event_Handler *>'s. More...

ACE_Select_Reactor_Handle_Set wait_set_
 Tracks handles that are waited for by <select>. More...

ACE_Select_Reactor_Handle_Set suspend_set_
 Tracks handles that are currently suspended. More...

ACE_Select_Reactor_Handle_Set ready_set_
 Track HANDLES we are interested in for various events that must be dispatched *without* going through <select>. More...

ACE_Timer_Queuetimer_queue_
 Defined as a pointer to allow overriding by derived classes... More...

int delete_timer_queue_
 Keeps track of whether we should delete the timer queue (if we didn't create it, then we don't delete it). More...

ACE_Sig_Handlersignal_handler_
 Handle signals without requiring global/static variables. More...

int delete_signal_handler_
 Keeps track of whether we should delete the signal handler (if we didn't create it, then we don't delete it). More...

ACE_Reactor_Notifynotify_handler_
 Callback object that unblocks the <ACE_Select_Reactor> if it's sleeping. More...

int delete_notify_handler_
 Keeps track of whether we need to delete the notify handler (if we didn't create it, then we don't delete it). More...

int restart_
 Restart the <handle_events> event-loop method automatically when <select> is interrupted via <EINTR>. More...

int requeue_position_
int initialized_
 True if we've been initialized yet... More...

ACE_thread_t owner_
 The original thread that created this Select_Reactor. More...

int state_changed_

Private Methods

 ACE_Select_Reactor_Impl (const ACE_Select_Reactor_Impl &)
 Deny access since member-wise won't work... More...

ACE_Select_Reactor_Impl & operator= (const ACE_Select_Reactor_Impl &)

Private Attributes

int supress_renew_
 Determine whether we should renew Select_Reactor's token after handling the notification message. More...


Friends

class ACE_Select_Reactor_Notify
class ACE_Select_Reactor_Handler_Repository

Detailed Description

This class simply defines how Select_Reactor's basic interface functions should look like and provides a common base class for <Select_Reactor> using various locking mechanism.

Definition at line 423 of file Select_Reactor_Base.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
DEFAULT_SIZE  Default size of the Select_Reactor's handle table.

Definition at line 426 of file Select_Reactor_Base.h.

00427   {
00428     /// Default size of the Select_Reactor's handle table.
00429     DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE
00430   };


Constructor & Destructor Documentation

ACE_INLINE ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl void   
 

Constructor.

Definition at line 60 of file Select_Reactor_Base.i.

00061     : handler_rep_ (*this),
00062       timer_queue_ (0),
00063       delete_timer_queue_ (0),
00064       delete_signal_handler_ (0),
00065       delete_notify_handler_ (0),
00066       requeue_position_ (-1), // Requeue at end of waiters by default.
00067       initialized_ (0),
00068       state_changed_ (0),
00069       supress_renew_ (0)
00070 {
00071 }

ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl const ACE_Select_Reactor_Impl &    [private]
 

Deny access since member-wise won't work...


Member Function Documentation

int ACE_Select_Reactor_Impl::bit_ops ACE_HANDLE    handle,
ACE_Reactor_Mask    mask,
ACE_Select_Reactor_Handle_Set   wait_Set,
int    ops
[protected, virtual]
 

Allow manipulation of the <wait_set_> mask and <ready_set_> mask.

Definition at line 1049 of file Select_Reactor_Base.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_BIT_ENABLED, ACE_FDS_PTMF, ACE_Reactor_Mask, ACE_SET_BITS, ACE_TRACE, ACE_Reactor::ADD_MASK, ACE_Handle_Set::clr_bit, ACE_Reactor::CLR_MASK, ACE_Event_Handler::CONNECT_MASK, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Event_Handler::EXCEPT_MASK, ACE_Reactor::GET_MASK, ACE_Select_Reactor_Handler_Repository::handle_in_range, handler_rep_, ACE_Handle_Set::is_set, ACE_Event_Handler::NULL_MASK, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Event_Handler::READ_MASK, ACE_Handle_Set::set_bit, ACE_Reactor::SET_MASK, ACE_Select_Reactor_Handle_Set::wr_mask_, and ACE_Event_Handler::WRITE_MASK.

Referenced by ACE_Select_Reactor_Handler_Repository::bind, ACE_TP_Reactor::mask_ops, and ACE_Select_Reactor_Handler_Repository::unbind.

01053 {
01054   ACE_TRACE ("ACE_Select_Reactor_Impl::bit_ops");
01055   if (this->handler_rep_.handle_in_range (handle) == 0)
01056     return -1;
01057 
01058 #if !defined (ACE_WIN32)
01059   ACE_Sig_Guard sb; // Block out all signals until method returns.
01060 #endif /* ACE_WIN32 */
01061 
01062   ACE_FDS_PTMF ptmf  = &ACE_Handle_Set::set_bit;
01063   u_long omask = ACE_Event_Handler::NULL_MASK;
01064 
01065   // Find the old reactor masks.  This automatically does the work of
01066   // the GET_MASK operation.
01067   if (handle_set.rd_mask_.is_set (handle))
01068     ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK);
01069   if (handle_set.wr_mask_.is_set (handle))
01070     ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK);
01071   if (handle_set.ex_mask_.is_set (handle))
01072     ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK);
01073 
01074   switch (ops)
01075     {
01076     case ACE_Reactor::GET_MASK:
01077       // The work for this operation is done in all cases at the
01078       // begining of the function.
01079       break;
01080     case ACE_Reactor::CLR_MASK:
01081       ptmf = &ACE_Handle_Set::clr_bit;
01082       /* FALLTHRU */
01083     case ACE_Reactor::SET_MASK:
01084       /* FALLTHRU */
01085     case ACE_Reactor::ADD_MASK:
01086 
01087       // The following code is rather subtle...  Note that if we are
01088       // doing a ACE_Reactor::SET_MASK then if the bit is not enabled
01089       // in the mask we need to clear the bit from the ACE_Handle_Set.
01090       // On the other hand, if we are doing a ACE_Reactor::CLR_MASK or
01091       // a ACE_Reactor::ADD_MASK we just carry out the operations
01092       // specified by the mask.
01093 
01094       // READ, ACCEPT, and CONNECT flag will place the handle in the
01095       // read set.
01096       if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)
01097           || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)
01098           || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK))
01099         {
01100           (handle_set.rd_mask_.*ptmf) (handle);
01101         }
01102       else if (ops == ACE_Reactor::SET_MASK)
01103         handle_set.rd_mask_.clr_bit (handle);
01104 
01105       // WRITE and CONNECT flag will place the handle in the write set
01106       if (ACE_BIT_ENABLED (mask,
01107                            ACE_Event_Handler::WRITE_MASK)
01108           || ACE_BIT_ENABLED (mask,
01109                               ACE_Event_Handler::CONNECT_MASK))
01110         {
01111           (handle_set.wr_mask_.*ptmf) (handle);
01112         }
01113       else if (ops == ACE_Reactor::SET_MASK)
01114         handle_set.wr_mask_.clr_bit (handle);
01115 
01116       // EXCEPT (and CONNECT on Win32) flag will place the handle in
01117       // the except set.
01118       if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)
01119 #if defined (ACE_WIN32)
01120           || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)
01121 #endif /* ACE_WIN32 */
01122           )
01123         {
01124           (handle_set.ex_mask_.*ptmf) (handle);
01125         }
01126       else if (ops == ACE_Reactor::SET_MASK)
01127         handle_set.ex_mask_.clr_bit (handle);
01128       break;
01129     default:
01130       return -1;
01131     }
01132   return omask;
01133 }

virtual int ACE_Select_Reactor_Impl::is_suspended_i ACE_HANDLE    handle [protected, pure virtual]
 

Check to see if the <Event_Handler> associated with <handle> is suspended. Returns 0 if not, 1 if so.

Implemented in ACE_Select_Reactor_T.

Referenced by ACE_Select_Reactor_Handler_Repository::bind.

ACE_Select_Reactor_Impl& ACE_Select_Reactor_Impl::operator= const ACE_Select_Reactor_Impl &    [private]
 

ACE_INLINE int ACE_Select_Reactor_Impl::purge_pending_notifications ACE_Event_Handler   = 0,
ACE_Reactor_Mask    = ACE_Event_Handler::ALL_EVENTS_MASK
[virtual]
 

Purge any notifications pending in this reactor for the specified <ACE_Event_Handler> object. Returns the number of notifications purged. Returns -1 on error.

Implements ACE_Reactor_Impl.

Definition at line 74 of file Select_Reactor_Base.i.

References ACE_Reactor_Mask, notify_handler_, and ACE_Reactor_Notify::purge_pending_notifications.

00076 {
00077   if (this->notify_handler_ == 0)
00078     return 0;
00079   else
00080     return this->notify_handler_->purge_pending_notifications (eh, mask);
00081 }

virtual void ACE_Select_Reactor_Impl::renew void    [protected, pure virtual]
 

Enqueue ourselves into the list of waiting threads at the appropriate point specified by <requeue_position_>.

Implemented in ACE_Select_Reactor_T.

Referenced by ACE_Select_Reactor_Notify::handle_input.

int ACE_Select_Reactor_Impl::resumable_handler void    [virtual]
 

Does the reactor allow the application to resume the handle on its own ie. can it pass on the control of handle resumption to the application. The select reactor has no handlers that can be resumed by the application. So return 0;.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 1136 of file Select_Reactor_Base.cpp.

01137 {
01138   // The select reactor has no handlers that can be resumed by the
01139   // application. So return 0;
01140 
01141   return 0;
01142 }

ACE_INLINE void ACE_Select_Reactor_Impl::supress_notify_renew int    sr [protected]
 

Definition at line 90 of file Select_Reactor_Base.i.

References supress_renew_.

00091 {
00092   this->supress_renew_ = sr;
00093 }

ACE_INLINE int ACE_Select_Reactor_Impl::supress_notify_renew void    [protected]
 

Controls/access whether the notify handler should renew the Select_Reactor's token or not.

Definition at line 84 of file Select_Reactor_Base.i.

References supress_renew_.

Referenced by ACE_TP_Reactor::ACE_TP_Reactor, and ACE_Select_Reactor_T::renew.

00085 {
00086   return this->supress_renew_;
00087 }


Friends And Related Function Documentation

friend class ACE_Select_Reactor_Handler_Repository [friend]
 

Definition at line 436 of file Select_Reactor_Base.h.

friend class ACE_Select_Reactor_Notify [friend]
 

Definition at line 435 of file Select_Reactor_Base.h.


Member Data Documentation

int ACE_Select_Reactor_Impl::delete_notify_handler_ [protected]
 

Keeps track of whether we need to delete the notify handler (if we didn't create it, then we don't delete it).

Definition at line 500 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::close.

int ACE_Select_Reactor_Impl::delete_signal_handler_ [protected]
 

Keeps track of whether we should delete the signal handler (if we didn't create it, then we don't delete it).

Definition at line 492 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::close.

int ACE_Select_Reactor_Impl::delete_timer_queue_ [protected]
 

Keeps track of whether we should delete the timer queue (if we didn't create it, then we don't delete it).

Definition at line 485 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::close.

ACE_Select_Reactor_Handler_Repository ACE_Select_Reactor_Impl::handler_rep_ [protected]
 

Table that maps <ACE_HANDLEs> to <ACE_Event_Handler *>'s.

Definition at line 468 of file Select_Reactor_Base.h.

Referenced by bit_ops, ACE_Select_Reactor_T::close, ACE_Select_Reactor_T::dump, ACE_TP_Reactor::handle_socket_events, ACE_Select_Reactor_T::is_suspended_i, ACE_QtReactor::QtWaitForMultipleEvents, ACE_TP_Reactor::remove_handler, ACE_Select_Reactor_T::resume_i, ACE_Select_Reactor_T::size, ACE_Select_Reactor_T::suspend_i, ACE_TkReactor::TkWaitForMultipleEvents, ACE_XtReactor::wait_for_multiple_events, ACE_TkReactor::wait_for_multiple_events, ACE_QtReactor::wait_for_multiple_events, ACE_FlReactor::wait_for_multiple_events, and ACE_XtReactor::XtWaitForMultipleEvents.

int ACE_Select_Reactor_Impl::initialized_ [protected]
 

True if we've been initialized yet...

Definition at line 516 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::close, and ACE_Select_Reactor_T::initialized.

ACE_Reactor_Notify* ACE_Select_Reactor_Impl::notify_handler_ [protected]
 

Callback object that unblocks the <ACE_Select_Reactor> if it's sleeping.

Definition at line 496 of file Select_Reactor_Base.h.

Referenced by ACE_FlReactor::ACE_FlReactor, ACE_QtReactor::ACE_QtReactor, ACE_TkReactor::ACE_TkReactor, ACE_XtReactor::ACE_XtReactor, ACE_Select_Reactor_T::close, ACE_Select_Reactor_T::dump, ACE_TP_Reactor::get_notify_handle, ACE_TP_Reactor::handle_notify_events, ACE_TP_Reactor::handle_socket_events, ACE_Select_Reactor_T::max_notify_iterations, ACE_Select_Reactor_T::notify, and purge_pending_notifications.

ACE_thread_t ACE_Select_Reactor_Impl::owner_ [protected]
 

The original thread that created this Select_Reactor.

Definition at line 519 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::owner.

ACE_Select_Reactor_Handle_Set ACE_Select_Reactor_Impl::ready_set_ [protected]
 

Track HANDLES we are interested in for various events that must be dispatched *without* going through <select>.

Definition at line 478 of file Select_Reactor_Base.h.

Referenced by ACE_TP_Reactor::clear_handle_read_set, ACE_TP_Reactor::get_event_for_dispatching, ACE_TP_Reactor::get_notify_handle, and ACE_TP_Reactor::handle_notify_events.

int ACE_Select_Reactor_Impl::requeue_position_ [protected]
 

Position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a <notify> callback. If this value == -1 we are requeued at the end of the list. Else if it's 0 then we are requeued at the front of the list. Else if it's > 1 then that indicates the number of waiters to skip over.

Definition at line 513 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::requeue_position.

int ACE_Select_Reactor_Impl::restart_ [protected]
 

Restart the <handle_events> event-loop method automatically when <select> is interrupted via <EINTR>.

Definition at line 504 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::handle_error, and ACE_Select_Reactor_T::restart.

ACE_Sig_Handler* ACE_Select_Reactor_Impl::signal_handler_ [protected]
 

Handle signals without requiring global/static variables.

Definition at line 488 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::close, ACE_Select_Reactor_T::dump, ACE_Select_Reactor_T::handler_i, ACE_Select_Reactor_T::register_handler, and ACE_Select_Reactor_T::remove_handler.

int ACE_Select_Reactor_Impl::state_changed_ [protected]
 

True if state has changed during dispatching of <ACE_Event_Handlers>, else false. This is used to determine whether we need to make another trip through the <Select_Reactor>'s <wait_for_multiple_events> loop.

Definition at line 527 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_Handler_Repository::bind, ACE_Priority_Reactor::dispatch_io_set, ACE_TP_Reactor::get_event_for_dispatching, and ACE_Select_Reactor_Handler_Repository::unbind.

int ACE_Select_Reactor_Impl::supress_renew_ [private]
 

Determine whether we should renew Select_Reactor's token after handling the notification message.

Definition at line 537 of file Select_Reactor_Base.h.

Referenced by supress_notify_renew.

ACE_Select_Reactor_Handle_Set ACE_Select_Reactor_Impl::suspend_set_ [protected]
 

Tracks handles that are currently suspended.

Definition at line 474 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::is_suspended_i, ACE_TP_Reactor::mask_ops, ACE_Select_Reactor_T::resume_i, ACE_Select_Reactor_T::suspend_i, and ACE_Select_Reactor_Handler_Repository::unbind.

ACE_Timer_Queue* ACE_Select_Reactor_Impl::timer_queue_ [protected]
 

Defined as a pointer to allow overriding by derived classes...

Definition at line 481 of file Select_Reactor_Base.h.

Referenced by ACE_Select_Reactor_T::cancel_timer, ACE_Select_Reactor_T::close, ACE_Select_Reactor_T::dump, ACE_TP_Reactor::handle_timer_events, ACE_XtReactor::reset_timeout, ACE_TkReactor::reset_timeout, ACE_QtReactor::reset_timeout, ACE_FlReactor::reset_timeout, ACE_Select_Reactor_T::timer_queue, ACE_XtReactor::wait_for_multiple_events, ACE_TkReactor::wait_for_multiple_events, ACE_QtReactor::wait_for_multiple_events, and ACE_FlReactor::wait_for_multiple_events.

ACE_Select_Reactor_Handle_Set ACE_Select_Reactor_Impl::wait_set_ [protected]
 

Tracks handles that are waited for by <select>.

Definition at line 471 of file Select_Reactor_Base.h.

Referenced by ACE_QtReactor::ACE_QtReactor, ACE_FlReactor::fl_io_proc, ACE_XtReactor::InputCallbackProc, ACE_TkReactor::InputCallbackProc, ACE_Select_Reactor_T::resume_i, ACE_Select_Reactor_T::suspend_i, ACE_Select_Reactor_Handler_Repository::unbind, ACE_XtReactor::wait_for_multiple_events, ACE_TkReactor::wait_for_multiple_events, ACE_QtReactor::wait_for_multiple_events, and ACE_FlReactor::wait_for_multiple_events.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:55:41 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002