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

ACE_Select_Reactor_T Class Template Reference

An object oriented event demultiplexor and event handler dispatcher. More...

#include <Select_Reactor_T.h>

Inheritance diagram for ACE_Select_Reactor_T:

Inheritance graph
[legend]
Collaboration diagram for ACE_Select_Reactor_T:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Select_Reactor_T (ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *notify=0, int mask_signals=1, int s_queue=ACE_SELECT_TOKEN::FIFO)
 If <disable_notify_pipe> is non-0 then the reactor will not create a notification pipe, which will save two I/O handles but will elide the <notify()> feature. If <mask_signals> is 1 the reactor is "signal-safe" when dispatching handlers to signal events, whereas if <mask_signals> is 0 the reactor will be more efficient, but not signal-safe (which may be perfectly fine if your application doesn't use the reactor to handle signals). More...

 ACE_Select_Reactor_T (size_t size, int restart=0, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *notify=0, int mask_signals=1, int s_queue=ACE_SELECT_TOKEN::FIFO)
 Initialize ACE_Select_Reactor with size
  • size. If
  • disable_notify_pipe is non-0 then the reactor will not create a notification pipe, which will save two I/O handles but will elide the notification feature. If
  • mask_signals is 1 the reactor is "signal-safe" when dispatching handlers to signal events, whereas if
  • mask_signals is 0 the reactor will be more efficient, but not signal-safe (which may be perfectly fine if your application doesn't use the reactor to handle signals).
More...


virtual int open (size_t max_number_of_handles=DEFAULT_SIZE, int restart=0, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *=0)
virtual int current_info (ACE_HANDLE, size_t &)
 Returns -1 (not used in this implementation);. More...

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)
 
Deprecated:
The following method is deprecated. Use <timer_queue> instead. Set a user specified timer queue.
More...


virtual int timer_queue (ACE_Timer_Queue *tq)
 Set a user-specified timer queue. More...

virtual ACE_Timer_Queuetimer_queue (void) const
 Return the current <ACE_Timer_Queue>. More...

virtual int close (void)
 Close down the select_reactor and release all of its resources. More...

virtual ~ACE_Select_Reactor_T (void)
 Close down the select_reactor and release all of its 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 deactivated (void)
virtual void deactivate (int do_stop)
virtual int register_handler (ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
virtual int register_handler (ACE_HANDLE handle, ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
virtual int register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle=ACE_INVALID_HANDLE)
 Not implemented. More...

virtual int register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
 Not implemented. More...

virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
 Register <eh> 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 *eh, ACE_Reactor_Mask mask)
virtual int remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask)
virtual int remove_handler (const ACE_Handle_Set &handle_set, ACE_Reactor_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 *eh)
 Temporarily suspend the <Event_Handler> associated with <eh>. More...

virtual int suspend_handler (ACE_HANDLE handle)
 Temporarily suspend the <Event_Handler> associated with <handle>. 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 the <Event_Handlers> in the Select_Reactor. More...

virtual int resume_handler (ACE_Event_Handler *eh)
 Resume a temporarily suspend <Event_Handler> associated with <eh>. More...

virtual int resume_handler (ACE_HANDLE handle)
 Resume a temporarily suspended <Event_Handler> associated with <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 the <Event_Handlers> in the Select_Reactor. More...

virtual int uses_event_associations (void)
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)
virtual int cancel_timer (long timer_id, const void **arg=0, int dont_call_handle_close=1)
virtual int schedule_wakeup (ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
 ADD the dispatch MASK "bit" bound with the <eh> and the <mask>. More...

virtual int schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask)
 ADD the dispatch MASK "bit" bound with the <handle> and the <mask>. More...

virtual int cancel_wakeup (ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
 CLR the dispatch MASK "bit" bound with the <eh> and the <mask>. More...

virtual int cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask)
 CLR the dispatch MASK "bit" bound with the <handle> and the <mask>. More...

virtual int notify (ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *=0)
virtual void max_notify_iterations (int)
virtual int max_notify_iterations (void)
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 void requeue_position (int)
 Set position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a <notify> callback. More...

virtual int requeue_position (void)
 Get position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a <notify> callback. More...

virtual int mask_ops (ACE_Event_Handler *eh, ACE_Reactor_Mask mask, int ops)
 GET/SET/ADD/CLR the dispatch mask "bit" bound with the <eh> 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 *eh, ACE_Reactor_Mask mask, int ops)
 GET/SET/ADD/CLR the ready "bit" bound with the <eh> and <mask>. More...

virtual int ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask, int ops)
 GET/SET/ADD/CLR the ready "bit" bound with the <handle> and <mask>. More...

virtual void wakeup_all_threads (void)
 Wake up all threads in waiting in the event loop. More...

virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id=0)
 Set the new owner of the thread and return the old owner. More...

virtual int owner (ACE_thread_t *)
 Return the current owner of the thread. More...

virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **eh=0)
virtual int handler (int signum, ACE_Event_Handler **=0)
virtual int initialized (void)
 Returns true if we've 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_Locklock (void)
virtual void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

virtual int register_handler_i (ACE_HANDLE handle, ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
 Do the work of actually binding the <handle> and <eh> with the <mask>. More...

virtual int register_handler_i (const ACE_Handle_Set &handles, ACE_Event_Handler *handler, ACE_Reactor_Mask mask)
 Register a set of <handles>. More...

virtual int remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask)
 Do the work of actually unbinding the <handle> and <eh> with the <mask>. More...

virtual int remove_handler_i (const ACE_Handle_Set &handles, ACE_Reactor_Mask)
 Remove a set of <handles>. More...

virtual int suspend_i (ACE_HANDLE handle)
 Suspend the <Event_Handler> associated with <handle>. More...

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

virtual int resume_i (ACE_HANDLE handle)
 Resume the <Event_Handler> associated with <handle>. More...

virtual int handler_i (ACE_HANDLE handle, ACE_Reactor_Mask, ACE_Event_Handler **=0)
 Implement the public <handler> method. More...

virtual int handler_i (int signum, ACE_Event_Handler **=0)
 Implement the public <handler> method. More...

virtual int any_ready (ACE_Select_Reactor_Handle_Set &handle_set)
virtual int any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set)
 Implement the <any_ready> method, assuming that the Sig_Guard is beign held. More...

virtual int handle_error (void)
 Take corrective action when errors occur. More...

virtual int check_handles (void)
 Make sure the handles are all valid. More...

virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, ACE_Time_Value *)
 Wait for events to occur. More...

virtual int dispatch (int nfound, ACE_Select_Reactor_Handle_Set &)
virtual int dispatch_timer_handlers (int &number_dispatched)
virtual int dispatch_notification_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set, int &number_of_active_handles, int &number_of_handlers_dispatched)
virtual int dispatch_io_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set, int &number_of_active_handles, int &number_of_handlers_dispatched)
virtual int dispatch_io_set (int number_of_active_handles, int &number_of_handlers_dispatched, int mask, ACE_Handle_Set &dispatch_mask, ACE_Handle_Set &ready_mask, ACE_EH_PTMF callback)
virtual void notify_handle (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Handle_Set &, ACE_Event_Handler *eh, ACE_EH_PTMF callback)
 Notify the appropriate <callback> in the context of the <eh> associated with <handle> that a particular event has occurred. More...

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

int release_token (void)
 Release the token lock when a Win32 structured exception occurs. More...

int handle_events_i (ACE_Time_Value *max_wait_time=0)
 Stops the VC++ compiler from bitching about exceptions and destructors. More...


Protected Attributes

ACE_SELECT_REACTOR_TOKEN token_
 Synchronization token for the MT_SAFE ACE_Select_Reactor. More...

ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN > lock_adapter_
 Adapter used to return internal lock to outside world. More...

sig_atomic_t deactivated_
 This flag is used to keep track of whether we are actively handling events or not. More...

int mask_signals_

Private Methods

 ACE_Select_Reactor_T (const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &)
 Deny access since member-wise won't work... More...

ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > & operator= (const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &)

Detailed Description

template<class ACE_SELECT_REACTOR_TOKEN>
class ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >

An object oriented event demultiplexor and event handler dispatcher.

The <ACE_Select_Reactor> is an object-oriented event demultiplexor and event handler dispatcher. The sources of events that the <ACE_Select_Reactor> waits for and dispatches includes I/O events, signals, and timer events. All public methods acquire the main <ACE_Select_Reactor_Token> lock and call down to private or protected methods, which assume that the lock is held and so therefore don't (re)acquire the lock.

Definition at line 113 of file Select_Reactor_T.h.


Constructor & Destructor Documentation

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ACE_Select_Reactor_T ACE_Sig_Handler   = 0,
ACE_Timer_Queue   = 0,
int    disable_notify_pipe = 0,
ACE_Reactor_Notify   notify = 0,
int    mask_signals = 1,
int    s_queue = ACE_SELECT_TOKEN::FIFO
 

If <disable_notify_pipe> is non-0 then the reactor will not create a notification pipe, which will save two I/O handles but will elide the <notify()> feature. If <mask_signals> is 1 the reactor is "signal-safe" when dispatching handlers to signal events, whereas if <mask_signals> is 0 the reactor will be more efficient, but not signal-safe (which may be perfectly fine if your application doesn't use the reactor to handle signals).

Definition at line 520 of file Select_Reactor_T.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and ACE::max_handles.

00526     : token_ (*this, s_queue),
00527       lock_adapter_ (token_),
00528       deactivated_ (0),
00529       mask_signals_ (mask_signals)
00530 {
00531   ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T");
00532 
00533   // First try to open the Reactor with the hard-coded default.
00534   if (this->open (ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::DEFAULT_SIZE,
00535                   0,
00536                   sh,
00537                   tq,
00538                   disable_notify_pipe,
00539                   notify) == -1)
00540     {
00541       // The hard-coded default Reactor size failed, so attempt to
00542       // determine the size at run-time by checking the process file
00543       // descriptor limit on platforms that support this feature.
00544 
00545       // There is no need to deallocate resources from previous open()
00546       // call since the open() method deallocates any resources prior
00547       // to exiting if an error was encountered.
00548 
00549       // Set the default reactor size to be the current limit on the
00550       // number of file descriptors available to the process.  This
00551       // size is not necessarily the maximum limit.
00552       if (this->open (ACE::max_handles (),
00553                      0,
00554                      sh,
00555                      tq,
00556                      disable_notify_pipe,
00557                      notify) == -1)
00558         ACE_ERROR ((LM_ERROR,
00559                     ACE_LIB_TEXT ("%p\n"),
00560                     ACE_LIB_TEXT ("ACE_Select_Reactor_T::open ")
00561                     ACE_LIB_TEXT ("failed inside ")
00562                     ACE_LIB_TEXT ("ACE_Select_Reactor_T::CTOR")));
00563     }
00564 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ACE_Select_Reactor_T size_t    size,
int    restart = 0,
ACE_Sig_Handler   = 0,
ACE_Timer_Queue   = 0,
int    disable_notify_pipe = 0,
ACE_Reactor_Notify   notify = 0,
int    mask_signals = 1,
int    s_queue = ACE_SELECT_TOKEN::FIFO
 

Initialize ACE_Select_Reactor with size

  • size. If
  • disable_notify_pipe is non-0 then the reactor will not create a notification pipe, which will save two I/O handles but will elide the notification feature. If
  • mask_signals is 1 the reactor is "signal-safe" when dispatching handlers to signal events, whereas if
  • mask_signals is 0 the reactor will be more efficient, but not signal-safe (which may be perfectly fine if your application doesn't use the reactor to handle signals).

Note:
On Unix platforms, the size parameter should be as large as the maximum number of file descriptors allowed for a given process. This is necessary since a file descriptor is used to directly index the array of event handlers maintained by the Reactor's handler repository. Direct indexing is used for efficiency reasons.

Definition at line 570 of file Select_Reactor_T.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, and LM_ERROR.

00578     : token_ (*this, s_queue),
00579       lock_adapter_ (token_),
00580       deactivated_ (0),
00581       mask_signals_ (mask_signals)
00582 {
00583   ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T");
00584 
00585   if (this->open (size,
00586                   rs,
00587                   sh,
00588                   tq,
00589                   disable_notify_pipe,
00590                   notify) == -1)
00591     ACE_ERROR ((LM_ERROR,
00592                 ACE_LIB_TEXT ("%p\n"),
00593                 ACE_LIB_TEXT ("ACE_Select_Reactor_T::open ")
00594                 ACE_LIB_TEXT ("failed inside ACE_Select_Reactor_T::CTOR")));
00595 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::~ACE_Select_Reactor_T void    [virtual]
 

Close down the select_reactor and release all of its resources.

Definition at line 646 of file Select_Reactor_T.cpp.

References ACE_TRACE, and close.

00647 {
00648   ACE_TRACE ("ACE_Select_Reactor_T::~ACE_Select_Reactor_T");
00649   this->close ();
00650 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ACE_Select_Reactor_T const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &    [private]
 

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


Member Function Documentation

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::alertable_handle_events ACE_Time_Value   max_wait_time [virtual]
 

Implements ACE_Reactor_Impl.

Definition at line 197 of file Select_Reactor_T.i.

References handle_events.

00198 {
00199   return this->handle_events (max_wait_time);
00200 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::alertable_handle_events ACE_Time_Value   max_wait_time = 0 [virtual]
 

Implements ACE_Reactor_Impl.

Definition at line 191 of file Select_Reactor_T.i.

References handle_events.

00192 {
00193   return this->handle_events (max_wait_time);
00194 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::any_ready ACE_Select_Reactor_Handle_Set   handle_set [protected, virtual]
 

Check if there are any HANDLEs enabled in the <ready_set_>, and if so, update the <handle_set> and return the number ready. If there aren't any HANDLEs enabled return 0.

Definition at line 38 of file Select_Reactor_T.cpp.

References ACE_TRACE.

00039 {
00040   ACE_TRACE ("ACE_Select_Reactor_T::any_ready");
00041 
00042   if (this->mask_signals_)
00043     {
00044 #if !defined (ACE_WIN32)
00045       // Make this call signal safe.
00046       ACE_Sig_Guard sb;
00047 #endif /* ACE_WIN32 */
00048 
00049       return this->any_ready_i (wait_set);
00050     }
00051   return this->any_ready_i (wait_set);
00052 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::any_ready_i ACE_Select_Reactor_Handle_Set   handle_set [protected, virtual]
 

Implement the <any_ready> method, assuming that the Sig_Guard is beign held.

Definition at line 56 of file Select_Reactor_T.cpp.

00057 {
00058   int number_ready = this->ready_set_.rd_mask_.num_set ()
00059     + this->ready_set_.wr_mask_.num_set ()
00060     + this->ready_set_.ex_mask_.num_set ();
00061 
00062   if (number_ready > 0 && &wait_set != &(this->ready_set_))
00063     {
00064       wait_set.rd_mask_ = this->ready_set_.rd_mask_;
00065       wait_set.wr_mask_ = this->ready_set_.wr_mask_;
00066       wait_set.ex_mask_ = this->ready_set_.ex_mask_;
00067 
00068       this->ready_set_.rd_mask_.reset ();
00069       this->ready_set_.wr_mask_.reset ();
00070       this->ready_set_.ex_mask_.reset ();
00071     }
00072 
00073   return number_ready;
00074 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_timer long    timer_id,
const void **    arg = 0,
int    dont_call_handle_close = 1
[virtual]
 

Cancel the single <ACE_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. If <dont_call_handle_close> is 0 then the <handle_close> method of <event_handler> will be invoked. Returns 1 if cancellation succeeded and 0 if the <timer_id> wasn't found.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_FlReactor.

Definition at line 744 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Timer_Queue_T< ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall< ACE_SYNCH_RECURSIVE_MUTEX >, ACE_SYNCH_RECURSIVE_MUTEX >::cancel, and ACE_Select_Reactor_Impl::timer_queue_.

00747 {
00748   ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer");
00749   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00750 
00751   if (this->timer_queue_ != 0)
00752     return this->timer_queue_->cancel (timer_id,
00753                                        arg,
00754                                        dont_call_handle_close);
00755   else
00756     return 0;
00757 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_timer ACE_Event_Handler   event_handler,
int    dont_call_handle_close = 1
[virtual]
 

Cancel all <event_handlers> that match the address of <event_handler>. If <dont_call_handle_close> is 0 then the <handle_close> method of <event_handler> will be invoked. Returns number of handler's cancelled.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_FlReactor.

Definition at line 731 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Timer_Queue_T< ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall< ACE_SYNCH_RECURSIVE_MUTEX >, ACE_SYNCH_RECURSIVE_MUTEX >::cancel, and ACE_Select_Reactor_Impl::timer_queue_.

00733 {
00734   ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer");
00735   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00736 
00737   if (this->timer_queue_ != 0)
00738     return this->timer_queue_->cancel (handler, dont_call_handle_close);
00739   else
00740     return 0;
00741 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_wakeup ACE_HANDLE    handle,
ACE_Reactor_Mask    mask
[virtual]
 

CLR the dispatch MASK "bit" bound with the <handle> and the <mask>.

Implements ACE_Reactor_Impl.

Definition at line 168 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor::CLR_MASK, and mask_ops.

00170 {
00171   ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
00172   return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK);
00173 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_wakeup ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

CLR the dispatch MASK "bit" bound with the <eh> and the <mask>.

Implements ACE_Reactor_Impl.

Definition at line 152 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor::CLR_MASK, ACE_Event_Handler::get_handle, and mask_ops.

00154 {
00155   ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
00156   return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK);
00157 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::check_handles void    [protected, virtual]
 

Make sure the handles are all valid.

Definition at line 1385 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Select_Reactor_Handler_Repository_Iterator::advance, ACE_Event_Handler::ALL_EVENTS_MASK, ACE_Handle_Set::clr_bit, ACE_OS::fstat, ACE_Event_Handler::get_handle, ACE_Select_Reactor_Handler_Repository_Iterator::next, remove_handler_i, ACE_OS::select, ACE_Handle_Set::set_bit, and ACE_Time_Value::zero.

Referenced by handle_error.

01386 {
01387   ACE_TRACE ("ACE_Select_Reactor_T::check_handles");
01388 
01389 #if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_PSOS) || defined (VXWORKS)
01390   ACE_Time_Value time_poll = ACE_Time_Value::zero;
01391   ACE_Handle_Set rd_mask;
01392 #endif /* ACE_WIN32 || MVS || ACE_PSOS || VXWORKS */
01393 
01394   ACE_Event_Handler *eh = 0;
01395   int result = 0;
01396 
01397   for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_);
01398        iter.next (eh) != 0;
01399        iter.advance ())
01400     {
01401       ACE_HANDLE handle = eh->get_handle ();
01402 
01403       // Skip back to the beginning of the loop if the HANDLE is
01404       // invalid.
01405       if (handle == ACE_INVALID_HANDLE)
01406         continue;
01407 
01408 #if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_PSOS) || defined (VXWORKS)
01409       // Win32 needs to do the check this way because fstat won't work on
01410       // a socket handle.  MVS Open Edition needs to do it this way because,
01411       // even though the docs say to check a handle with either select or
01412       // fstat, the fstat method always says the handle is ok.
01413       // pSOS needs to do it this way because file handles and socket handles
01414       // are maintained by separate pieces of the system.  VxWorks needs the select
01415       // variant since fstat always returns an error on socket FDs.
01416       rd_mask.set_bit (handle);
01417 
01418       int select_width;
01419 #  if defined (ACE_WIN64)
01420       // This arg is ignored on Windows and causes pointer truncation
01421       // warnings on 64-bit compiles.
01422       select_width = 0;
01423 #  else
01424       select_width = int (handle) + 1;
01425 #  endif /* ACE_WIN64 */
01426 
01427       if (ACE_OS::select (select_width,
01428                           rd_mask, 0, 0,
01429                           &time_poll) < 0)
01430         {
01431           result = 1;
01432           this->remove_handler_i (handle,
01433                                   ACE_Event_Handler::ALL_EVENTS_MASK);
01434         }
01435       rd_mask.clr_bit (handle);
01436 #else /* !ACE_WIN32 && !MVS && !ACE_PSOS */
01437       struct stat temp;
01438 
01439       if (ACE_OS::fstat (handle, &temp) == -1)
01440         {
01441           result = 1;
01442           this->remove_handler_i (handle,
01443                                   ACE_Event_Handler::ALL_EVENTS_MASK);
01444         }
01445 #endif /* ACE_WIN32 || MVS || ACE_PSOS */
01446     }
01447 
01448   return result;
01449 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::close void    [virtual]
 

Close down the select_reactor and release all of its resources.

Implements ACE_Reactor_Impl.

Definition at line 602 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Reactor_Notify::close, ACE_Select_Reactor_Handler_Repository::close, ACE_Select_Reactor_Impl::delete_notify_handler_, ACE_Select_Reactor_Impl::delete_signal_handler_, ACE_Select_Reactor_Impl::delete_timer_queue_, ACE_Select_Reactor_Impl::handler_rep_, ACE_Select_Reactor_Impl::initialized_, ACE_Select_Reactor_Impl::notify_handler_, ACE_Select_Reactor_Impl::signal_handler_, and ACE_Select_Reactor_Impl::timer_queue_.

Referenced by ~ACE_Select_Reactor_T.

00603 {
00604   ACE_TRACE ("ACE_Select_Reactor_T::close");
00605   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00606 
00607   if (this->delete_signal_handler_)
00608     {
00609       delete this->signal_handler_;
00610       this->signal_handler_ = 0;
00611       this->delete_signal_handler_ = 0;
00612     }
00613 
00614   this->handler_rep_.close ();
00615 
00616   if (this->delete_timer_queue_)
00617     {
00618       delete this->timer_queue_;
00619       this->timer_queue_ = 0;
00620       this->delete_timer_queue_ = 0;
00621     }
00622 
00623   if (this->notify_handler_ != 0)
00624     this->notify_handler_->close ();
00625 
00626   if (this->delete_notify_handler_)
00627     {
00628       delete this->notify_handler_;
00629       this->notify_handler_ = 0;
00630       this->delete_notify_handler_ = 0;
00631     }
00632 
00633   this->initialized_ = 0;
00634 
00635   return 0;
00636 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::current_info ACE_HANDLE   ,
size_t &   
[virtual]
 

Returns -1 (not used in this implementation);.

Implements ACE_Reactor_Impl.

Definition at line 640 of file Select_Reactor_T.cpp.

00641 {
00642   return -1;
00643 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivate int    do_stop [virtual]
 

Control whether the Reactor will handle any more incoming events or not. If <do_stop> == 1, the Reactor will be disabled. By default, a reactor is in active state and can be deactivated/reactived as wish.

Implements ACE_Reactor_Impl.

Definition at line 209 of file Select_Reactor_T.i.

References deactivated_, and wakeup_all_threads.

00210 {
00211   this->deactivated_ = do_stop;
00212   this->wakeup_all_threads ();
00213 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivated void    [virtual]
 

Return the status of Reactor. If this function returns 0, the reactor is actively handling events. If it returns non-zero, <handling_events> and <handle_alertable_events> return -1 immediately.

Implements ACE_Reactor_Impl.

Definition at line 203 of file Select_Reactor_T.i.

References deactivated_.

00204 {
00205   return this->deactivated_;
00206 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dispatch int    nfound,
ACE_Select_Reactor_Handle_Set  
[protected, virtual]
 

Template Method that dispatches <ACE_Event_Handler>s for time events, I/O events, and signal events. Returns the total number of <ACE_Event_Handler>s that were dispatched or -1 if something goes wrong.

Definition at line 1223 of file Select_Reactor_T.cpp.

References ACE_TRACE, and ACE_Sig_Handler::sig_pending.

01225 {
01226   ACE_TRACE ("ACE_Select_Reactor_T::dispatch");
01227 
01228   int io_handlers_dispatched = 0;
01229   int other_handlers_dispatched = 0;
01230   int signal_occurred = 0;
01231   // The following do/while loop keeps dispatching as long as there
01232   // are still active handles.  Note that the only way we should ever
01233   // iterate more than once through this loop is if signals occur
01234   // while we're dispatching other handlers.
01235 
01236   do
01237     {
01238       // Note that we keep track of changes to our state.  If any of
01239       // the dispatch_*() methods below return -1 it means that the
01240       // <wait_set_> state has changed as the result of an
01241       // <ACE_Event_Handler> being dispatched.  This means that we
01242       // need to bail out and rerun the select() loop since our
01243       // existing notion of handles in <dispatch_set> may no longer be
01244       // correct.
01245       //
01246       // In the beginning, our state starts out unchanged.  After
01247       // every iteration (i.e., due to signals), our state starts out
01248       // unchanged again.
01249 
01250       this->state_changed_ = 0;
01251 
01252       // Perform the Template Method for dispatching all the handlers.
01253 
01254       // First check for interrupts.
01255       if (active_handle_count == -1)
01256         {
01257           // Bail out -- we got here since <select> was interrupted.
01258           if (ACE_Sig_Handler::sig_pending () != 0)
01259             {
01260               ACE_Sig_Handler::sig_pending (0);
01261 
01262               // If any HANDLES in the <ready_set_> are activated as a
01263               // result of signals they should be dispatched since
01264               // they may be time critical...
01265               active_handle_count = this->any_ready (dispatch_set);
01266 
01267               // Record the fact that the Reactor has dispatched a
01268               // handle_signal() method.  We need this to return the
01269               // appropriate count below.
01270               signal_occurred = 1;
01271             }
01272           else
01273             return -1;
01274         }
01275 
01276       // Handle timers early since they may have higher latency
01277       // constraints than I/O handlers.  Ideally, the order of
01278       // dispatching should be a strategy...
01279       else if (this->dispatch_timer_handlers (other_handlers_dispatched) == -1)
01280         // State has changed or timer queue has failed, exit loop.
01281         break;
01282 
01283       // Check to see if there are no more I/O handles left to
01284       // dispatch AFTER we've handled the timers...
01285       else if (active_handle_count == 0)
01286         return io_handlers_dispatched
01287           + other_handlers_dispatched
01288           + signal_occurred;
01289 
01290       // Next dispatch the notification handlers (if there are any to
01291       // dispatch).  These are required to handle multi-threads that
01292       // are trying to update the <Reactor>.
01293 
01294       else if (this->dispatch_notification_handlers
01295                (dispatch_set,
01296                 active_handle_count,
01297                 other_handlers_dispatched) == -1)
01298         // State has changed or a serious failure has occured, so exit
01299         // loop.
01300         break;
01301 
01302       // Finally, dispatch the I/O handlers.
01303       else if (this->dispatch_io_handlers
01304                (dispatch_set,
01305                 active_handle_count,
01306                 io_handlers_dispatched) == -1)
01307         // State has changed, so exit loop.
01308         break;
01309     }
01310   while (active_handle_count > 0);
01311 
01312   return io_handlers_dispatched + other_handlers_dispatched + signal_occurred;
01313 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dispatch_io_handlers ACE_Select_Reactor_Handle_Set   dispatch_set,
int &    number_of_active_handles,
int &    number_of_handlers_dispatched
[protected, virtual]
 

Dispatch all the input/output/except handlers that are enabled in the <dispatch_set>. Updates <number_of_active_handles> and <number_of_handlers_dispatched> according to the behavior of the number Returns -1 if the state of the <wait_set_> has changed, else 0.

Definition at line 1173 of file Select_Reactor_T.cpp.

References ACE_Event_Handler::EXCEPT_MASK, ACE_Event_Handler::handle_exception, ACE_Event_Handler::handle_input, ACE_Event_Handler::handle_output, ACE_Event_Handler::READ_MASK, and ACE_Event_Handler::WRITE_MASK.

01176 {
01177   // Handle output events (this code needs to come first to handle the
01178   // obscure case of piggy-backed data coming along with the final
01179   // handshake message of a nonblocking connection).
01180 
01181   // ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("ACE_Select_Reactor_T::dispatch - WRITE\n")));
01182   if (this->dispatch_io_set (number_of_active_handles,
01183                              number_of_handlers_dispatched,
01184                              ACE_Event_Handler::WRITE_MASK,
01185                              dispatch_set.wr_mask_,
01186                              this->ready_set_.wr_mask_,
01187                              &ACE_Event_Handler::handle_output) == -1)
01188     {
01189       number_of_active_handles -= number_of_handlers_dispatched;
01190       return -1;
01191     }
01192 
01193   // ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("ACE_Select_Reactor_T::dispatch - EXCEPT\n")));
01194   if (this->dispatch_io_set (number_of_active_handles,
01195                              number_of_handlers_dispatched,
01196                              ACE_Event_Handler::EXCEPT_MASK,
01197                              dispatch_set.ex_mask_,
01198                              this->ready_set_.ex_mask_,
01199                              &ACE_Event_Handler::handle_exception) == -1)
01200     {
01201       number_of_active_handles -= number_of_handlers_dispatched;
01202       return -1;
01203     }
01204 
01205   // ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("ACE_Select_Reactor_T::dispatch - READ\n")));
01206   if (this->dispatch_io_set (number_of_active_handles,
01207                              number_of_handlers_dispatched,
01208                              ACE_Event_Handler::READ_MASK,
01209                              dispatch_set.rd_mask_,
01210                              this->ready_set_.rd_mask_,
01211                              &ACE_Event_Handler::handle_input) == -1)
01212     {
01213       number_of_active_handles -= number_of_handlers_dispatched;
01214       return -1;
01215     }
01216 
01217   number_of_active_handles -= number_of_handlers_dispatched;
01218   return 0;
01219 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dispatch_io_set int    number_of_active_handles,
int &    number_of_handlers_dispatched,
int    mask,
ACE_Handle_Set   dispatch_mask,
ACE_Handle_Set   ready_mask,
ACE_EH_PTMF    callback
[protected, virtual]
 

Factors the dispatching of an io handle set (each WRITE, EXCEPT or READ set of handles). It updates the <number_of_handlers_dispatched> and invokes this->notify_handle for all the handles in <dispatch_set> using the <mask>, <ready_set> and <callback> parameters. Must return -1 if this->state_changed otherwise it must return 0.

Reimplemented in ACE_Priority_Reactor.

Definition at line 1141 of file Select_Reactor_T.cpp.

References ACE_EH_PTMF.

01147 {
01148   ACE_HANDLE handle;
01149 
01150   ACE_Handle_Set_Iterator handle_iter (dispatch_mask);
01151 
01152   while ((handle = handle_iter ()) != ACE_INVALID_HANDLE
01153          && number_of_handlers_dispatched < number_of_active_handles
01154          && this->state_changed_ == 0)
01155     {
01156       // ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("ACE_Select_Reactor_T::dispatching\n")));
01157       number_of_handlers_dispatched++;
01158       this->notify_handle (handle,
01159                            mask,
01160                            ready_mask,
01161                            this->handler_rep_.find (handle),
01162                            callback);
01163     }
01164 
01165   if (number_of_handlers_dispatched > 0 && this->state_changed_)
01166     return -1;
01167 
01168   return 0;
01169 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dispatch_notification_handlers ACE_Select_Reactor_Handle_Set   dispatch_set,
int &    number_of_active_handles,
int &    number_of_handlers_dispatched
[protected, virtual]
 

Dispatch any notification handlers. Returns -1 if the state of the <wait_set_> has changed, else returns number of handlers notified.

Definition at line 1118 of file Select_Reactor_T.cpp.

01121 {
01122   // Check to see if the ACE_HANDLE associated with the
01123   // Select_Reactor's notify hook is enabled.  If so, it means that
01124   // one or more other threads are trying to update the
01125   // ACE_Select_Reactor_T's internal tables or the notify pipe is
01126   // enabled.  We'll handle all these threads and notifications, and
01127   // then break out to continue the event loop.
01128 
01129   int n = this->notify_handler_->dispatch_notifications (number_of_active_handles,
01130                                                          dispatch_set.rd_mask_);
01131   if (n == -1)
01132     return -1;
01133   else
01134     number_of_handlers_dispatched += n;
01135 
01136   return this->state_changed_ ? -1 : 0;
01137 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dispatch_timer_handlers int &    number_dispatched [protected, virtual]
 

Dispatch all timer handlers that have expired. Returns -1 if the state of the <wait_set_> has changed, else 0. <number_dispatched> is set to the number of timer handlers dispatched.

Definition at line 1107 of file Select_Reactor_T.cpp.

01108 {
01109   number_of_handlers_dispatched += this->timer_queue_->expire ();
01110   if (this->state_changed_)
01111     return -1;
01112   else
01113     return 0;
01114 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dump void    const [virtual]
 

Dump the state of an object.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_Priority_Reactor.

Definition at line 1452 of file Select_Reactor_T.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, ACE_Reactor_Notify::dump, ACE_Sig_Handler::dump, ACE_Select_Reactor_Handler_Repository::dump, ACE_Timer_Queue_T< ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall< ACE_SYNCH_RECURSIVE_MUTEX >, ACE_SYNCH_RECURSIVE_MUTEX >::dump, ACE_Select_Reactor_Impl::handler_rep_, LM_DEBUG, ACE_Select_Reactor_Impl::notify_handler_, ACE_Select_Reactor_Impl::signal_handler_, ACE_Select_Reactor_Impl::timer_queue_, and token_.

01453 {
01454   ACE_TRACE ("ACE_Select_Reactor_T::dump");
01455 
01456   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
01457 
01458   this->timer_queue_->dump ();
01459   this->handler_rep_.dump ();
01460   this->signal_handler_->dump ();
01461   ACE_DEBUG ((LM_DEBUG,
01462               ACE_LIB_TEXT ("delete_signal_handler_ = %d\n"),
01463               this->delete_signal_handler_));
01464 
01465   ACE_HANDLE h;
01466 
01467   for (ACE_Handle_Set_Iterator handle_iter_wr (this->wait_set_.wr_mask_);
01468        (h = handle_iter_wr ()) != ACE_INVALID_HANDLE;
01469        ++handle_iter_wr)
01470     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle = %d\n"), h));
01471 
01472   for (ACE_Handle_Set_Iterator handle_iter_rd (this->wait_set_.rd_mask_);
01473        (h = handle_iter_rd ()) != ACE_INVALID_HANDLE;
01474        ++handle_iter_rd)
01475     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle = %d\n"), h));
01476 
01477   for (ACE_Handle_Set_Iterator handle_iter_ex (this->wait_set_.ex_mask_);
01478        (h = handle_iter_ex ()) != ACE_INVALID_HANDLE;
01479        ++handle_iter_ex)
01480     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle = %d\n"), h));
01481 
01482   for (ACE_Handle_Set_Iterator handle_iter_wr_ready (this->ready_set_.wr_mask_);
01483        (h = handle_iter_wr_ready ()) != ACE_INVALID_HANDLE;
01484        ++handle_iter_wr_ready)
01485     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle_ready = %d\n"), h));
01486 
01487   for (ACE_Handle_Set_Iterator handle_iter_rd_ready (this->ready_set_.rd_mask_);
01488        (h = handle_iter_rd_ready ()) != ACE_INVALID_HANDLE;
01489        ++handle_iter_rd_ready)
01490     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle_ready = %d\n"), h));
01491 
01492   for (ACE_Handle_Set_Iterator handle_iter_ex_ready (this->ready_set_.ex_mask_);
01493        (h = handle_iter_ex_ready ()) != ACE_INVALID_HANDLE;
01494        ++handle_iter_ex_ready)
01495     ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle_ready = %d\n"), h));
01496 
01497   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("restart_ = %d\n"), this->restart_));
01498   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nrequeue_position_ = %d\n"), this->requeue_position_));
01499   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ninitialized_ = %d\n"), this->initialized_));
01500   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nowner_ = %d\n"), this->owner_));
01501 
01502 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
01503   this->notify_handler_->dump ();
01504   this->token_.dump ();
01505 #endif /* ACE_MT_SAFE */
01506 
01507   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
01508 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_error void    [protected, virtual]
 

Take corrective action when errors occur.

Definition at line 800 of file Select_Reactor_T.cpp.

References ACE_TRACE, check_handles, and ACE_Select_Reactor_Impl::restart_.

00801 {
00802   ACE_TRACE ("ACE_Select_Reactor_T::handle_error");
00803   if (errno == EINTR)
00804     return this->restart_;
00805 #if defined (__MVS__) || defined (ACE_WIN32) || defined (VXWORKS)
00806   // On MVS Open Edition and Win32, there can be a number of failure
00807   // codes on a bad socket, so check_handles on anything other than
00808   // EINTR.  VxWorks doesn't even bother to always set errno on error
00809   // in select (specifically, it doesn't return EBADF for bad FDs).
00810   else
00811     return this->check_handles ();
00812 #else
00813 #  if defined (ACE_PSOS)
00814   else if (errno == EBADS)
00815     return this->check_handles ();
00816 #  else
00817   else if (errno == EBADF)
00818     return this->check_handles ();
00819 #  endif /* ACE_PSOS */
00820   else
00821     return -1;
00822 #endif  /* __MVS__ || ACE_WIN32 */
00823 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events ACE_Time_Value   max_wait_time [virtual]
 

This method is just like the one above, except the <max_wait_time> value is a reference and can therefore never be NULL.

Current <alertable_handle_events> is identical to <handle_events>.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 792 of file Select_Reactor_T.cpp.

References ACE_TRACE.

00793 {
00794   ACE_TRACE ("ACE_Select_Reactor_T::handle_events");
00795 
00796   return this->handle_events (&max_wait_time);
00797 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events ACE_Time_Value   max_wait_time = 0 [virtual]
 

This event loop driver that blocks for <max_wait_time> before returning. It will return earlier if timer events, I/O events, or signal 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 I/O and Timer <ACE_Event_Handler>s that were dispatched, 0 if the <max_wait_time> elapsed without dispatching any handlers, or -1 if something goes wrong.

Current <alertable_handle_events> is identical to <handle_events>.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 1328 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_TRACE, ACE_Thread::self, ACE_OS::thr_equal, and ACE_Countdown_Time::update.

Referenced by alertable_handle_events.

01329 {
01330   ACE_TRACE ("ACE_Select_Reactor_T::handle_events");
01331 
01332 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
01333 
01334   // Stash the current time -- the destructor of this object will
01335   // automatically compute how much time elapsed since this method was
01336   // called.
01337   ACE_Countdown_Time countdown (max_wait_time);
01338 
01339   ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1);
01340 
01341   if (ACE_OS::thr_equal (ACE_Thread::self (),
01342                          this->owner_) == 0 || this->deactivated_)
01343     return -1;
01344 
01345   // Update the countdown to reflect time waiting for the mutex.
01346   countdown.update ();
01347 #else
01348   if (this->deactivated_)
01349     return -1;
01350 #endif /* ACE_MT_SAFE */
01351 
01352   return this->handle_events_i (max_wait_time);
01353 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events_i ACE_Time_Value   max_wait_time = 0 [protected]
 

Stops the VC++ compiler from bitching about exceptions and destructors.

Definition at line 1357 of file Select_Reactor_T.cpp.

References ACE_SEH_EXCEPT, and ACE_SEH_TRY.

01358 {
01359   int result = -1;
01360 
01361   ACE_SEH_TRY
01362     {
01363       ACE_Select_Reactor_Handle_Set dispatch_set;
01364 
01365       int number_of_active_handles =
01366         this->wait_for_multiple_events (dispatch_set,
01367                                         max_wait_time);
01368 
01369       result = this->dispatch (number_of_active_handles,
01370                                dispatch_set);
01371     }
01372   ACE_SEH_EXCEPT (this->release_token ())
01373     {
01374       // As it stands now, we catch and then rethrow all Win32
01375       // structured exceptions so that we can make sure to release the
01376       // <token_> lock correctly.
01377     }
01378 
01379   this->state_changed_ = 1;
01380 
01381   return result;
01382 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler int    signum,
ACE_Event_Handler **    = 0
[virtual]
 

Check to see if <signum> is associated with a valid Event_Handler bound to a signal. Return the <eh> associated with this <handler> if <eh> != 0.

Implements ACE_Reactor_Impl.

Definition at line 94 of file Select_Reactor_T.i.

References ACE_TRACE, and handler_i.

00095 {
00096   ACE_TRACE ("ACE_Select_Reactor_T::handler");
00097   return this->handler_i (signum, handler);
00098 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler ACE_HANDLE    handle,
ACE_Reactor_Mask    mask,
ACE_Event_Handler **    eh = 0
[virtual]
 

Check to see if <handle> is associated with a valid Event_Handler bound to <mask>. Return the <eh> associated with this <handler> if <eh> != 0.

Implements ACE_Reactor_Impl.

Definition at line 348 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

Referenced by handler_i.

00351 {
00352   ACE_TRACE ("ACE_Select_Reactor_T::handler");
00353   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00354   return this->handler_i (handle, mask, handler);
00355 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler_i int    signum,
ACE_Event_Handler **    = 0
[protected, virtual]
 

Implement the public <handler> method.

Definition at line 77 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Sig_Handler::handler, handler, and ACE_Select_Reactor_Impl::signal_handler_.

00079 {
00080   ACE_TRACE ("ACE_Select_Reactor_T::handler_i");
00081   ACE_Event_Handler *handler = this->signal_handler_->handler (signum);
00082 
00083   if (handler == 0)
00084     return -1;
00085   else if (eh != 0)
00086     *eh = handler;
00087   return 0;
00088 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler_i ACE_HANDLE    handle,
ACE_Reactor_Mask   ,
ACE_Event_Handler **    = 0
[protected, virtual]
 

Implement the public <handler> method.

Definition at line 875 of file Select_Reactor_T.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_TRACE, ACE_Event_Handler::EXCEPT_MASK, ACE_Event_Handler::READ_MASK, and ACE_Event_Handler::WRITE_MASK.

Referenced by handler.

00878 {
00879   ACE_TRACE ("ACE_Select_Reactor_T::handler_i");
00880   ACE_Event_Handler *h = this->handler_rep_.find (handle);
00881 
00882   if (h == 0)
00883     return -1;
00884   else
00885     {
00886       if ((ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)
00887            || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
00888           && this->wait_set_.rd_mask_.is_set (handle) == 0)
00889         return -1;
00890       if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)
00891           && this->wait_set_.wr_mask_.is_set (handle) == 0)
00892         return -1;
00893       if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)
00894           && this->wait_set_.ex_mask_.is_set (handle) == 0)
00895         return -1;
00896     }
00897 
00898   if (handler != 0)
00899     *handler = h;
00900   return 0;
00901 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::initialized void    [virtual]
 

Returns true if we've been successfully initialized, else false.

Implements ACE_Reactor_Impl.

Definition at line 91 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and ACE_Select_Reactor_Impl::initialized_.

00092 {
00093   ACE_TRACE ("ACE_Select_Reactor_T::initialized");
00094   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, 0));
00095   return this->initialized_;
00096 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::is_suspended_i ACE_HANDLE    handle [protected, virtual]
 

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

Implements ACE_Select_Reactor_Impl.

Definition at line 960 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::find, ACE_Select_Reactor_Impl::handler_rep_, ACE_Handle_Set::is_set, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Select_Reactor_Impl::suspend_set_, and ACE_Select_Reactor_Handle_Set::wr_mask_.

00961 {
00962   ACE_TRACE ("ACE_Select_Reactor_T::is_suspended_i");
00963   if (this->handler_rep_.find (handle) == 0)
00964     return 0;
00965 
00966   return this->suspend_set_.rd_mask_.is_set (handle) ||
00967          this->suspend_set_.wr_mask_.is_set (handle) ||
00968          this->suspend_set_.ex_mask_.is_set (handle)    ;
00969 
00970 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Lock & ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::lock void    [virtual]
 

Returns a reference to the <ACE_Select_Reactor_Token> that is used to serialize the internal Select_Reactor's processing logic. This can be useful for situations where you need to avoid deadlock efficiently when <ACE_Event_Handlers> are used in multiple threads.

Implements ACE_Reactor_Impl.

Definition at line 176 of file Select_Reactor_T.i.

References ACE_TRACE, and lock_adapter_.

00177 {
00178   ACE_TRACE ("ACE_Select_Reactor_T::lock");
00179   return this->lock_adapter_;
00180 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops ACE_HANDLE    handle,
ACE_Reactor_Mask    mask,
int    ops
[virtual]
 

GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle> and <mask>.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 860 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00863 {
00864   ACE_TRACE ("ACE_Select_Reactor_T::mask_ops");
00865   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00866   return this->bit_ops (handle, mask,
00867                         this->wait_set_,
00868                         ops);
00869 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask,
int    ops
[virtual]
 

GET/SET/ADD/CLR the dispatch mask "bit" bound with the <eh> and <mask>.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 135 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, and ACE_Event_Handler::get_handle.

Referenced by cancel_wakeup, and schedule_wakeup.

00138 {
00139   ACE_TRACE ("ACE_Select_Reactor_T::mask_ops");
00140   return this->mask_ops (handler->get_handle (), mask, ops);
00141 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::max_notify_iterations void    [virtual]
 

Get the maximum number of times that the <ACE_Select_Reactor_Notify::handle_input> method will iterate and dispatch the <ACE_Event_Handlers> that are passed in via the notify pipe before breaking out of its <recv> loop.

Implements ACE_Reactor_Impl.

Definition at line 170 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Reactor_Notify::max_notify_iterations, and ACE_Select_Reactor_Impl::notify_handler_.

00171 {
00172   ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations");
00173   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00174   return this->notify_handler_->max_notify_iterations ();
00175 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::max_notify_iterations int    [virtual]
 

Set the maximum number of times that the <ACE_Select_Reactor_Notify::handle_input> method will iterate and dispatch the <ACE_Event_Handlers> that are passed in via the notify pipe before breaking out of its <recv> loop. By default, this is set to -1, which means "iterate until the pipe 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.

Implements ACE_Reactor_Impl.

Definition at line 161 of file Select_Reactor_T.cpp.

References ACE_GUARD, ACE_MT, ACE_TRACE, ACE_Reactor_Notify::max_notify_iterations, and ACE_Select_Reactor_Impl::notify_handler_.

00162 {
00163   ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations");
00164   ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_));
00165 
00166   this->notify_handler_->max_notify_iterations (iterations);
00167 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::notify ACE_Event_Handler   = 0,
ACE_Reactor_Mask    = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value   = 0
[virtual]
 

Called by a thread when it wants to unblock the Select_Reactor. This wakeups the <ACE_Select_Reactor> if currently blocked in <select>/<poll>. Pass over both the <Event_Handler> *and* the <mask> to allow the caller to dictate which <Event_Handler> method the <Select_Reactor> will invoke. The <ACE_Time_Value> indicates how long to blocking trying to notify the <Select_Reactor>. If <timeout> == 0, the caller will block until action is possible, else will wait until the relative time specified in *<timeout> elapses).

Implements ACE_Reactor_Impl.

Definition at line 250 of file Select_Reactor_T.cpp.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor_Notify::notify, ACE_Select_Reactor_Impl::notify_handler_, and ssize_t.

Referenced by wakeup_all_threads.

00253 {
00254   ACE_TRACE ("ACE_Select_Reactor_T::notify");
00255 
00256   ssize_t n = 0;
00257 
00258   // Pass over both the Event_Handler *and* the mask to allow the
00259   // caller to dictate which Event_Handler method the receiver
00260   // invokes.  Note that this call can timeout.
00261 
00262   n = this->notify_handler_->notify (eh, mask, timeout);
00263   return n == -1 ? -1 : 0;
00264 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::notify_handle ACE_HANDLE    handle,
ACE_Reactor_Mask    mask,
ACE_Handle_Set  ,
ACE_Event_Handler   eh,
ACE_EH_PTMF    callback
[protected, virtual]
 

Notify the appropriate <callback> in the context of the <eh> associated with <handle> that a particular event has occurred.

Reimplemented in ACE_TP_Reactor.

Definition at line 827 of file Select_Reactor_T.cpp.

References ACE_EH_PTMF, ACE_Reactor_Mask, and ACE_TRACE.

00832 {
00833   ACE_TRACE ("ACE_Select_Reactor_T::notify_handle");
00834   // Check for removed handlers.
00835   if (event_handler == 0)
00836     return;
00837 
00838   int status = (event_handler->*ptmf) (handle);
00839 
00840   if (status < 0)
00841     this->remove_handler_i (handle, mask);
00842   else if (status > 0)
00843     ready_mask.set_bit (handle);
00844 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::open size_t    max_number_of_handles = DEFAULT_SIZE,
int    restart = 0,
ACE_Sig_Handler   = 0,
ACE_Timer_Queue   = 0,
int    disable_notify_pipe = 0,
ACE_Reactor_Notify   = 0
[virtual]
 

Initialize the ACE_Select_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. If
  • disable_notify_pipe is non-0 the notification pipe is not created, thereby saving two I/O handles.
Note:
On Unix platforms, the maximum_number_of_handles parameter should be as large as the maximum number of file descriptors allowed for a given process. This is necessary since a file descriptor is used to directly index the array of event handlers maintained by the Reactor's handler repository. Direct indexing is used for efficiency reasons.

Implements ACE_Reactor_Impl.

Definition at line 405 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_NEW_RETURN, ACE_TRACE, and ACE_Thread::self.

00411 {
00412   ACE_TRACE ("ACE_Select_Reactor_T::open");
00413   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00414 
00415   // Can't initialize ourselves more than once.
00416   if (this->initialized_ > 0)
00417     return -1;
00418 
00419   this->owner_ = ACE_Thread::self ();
00420   this->restart_ = restart;
00421   this->signal_handler_ = sh;
00422   this->timer_queue_ = tq;
00423   this->notify_handler_ = notify;
00424 
00425   int result = 0;
00426 
00427   // Allows the signal handler to be overridden.
00428   if (this->signal_handler_ == 0)
00429     {
00430       ACE_NEW_RETURN (this->signal_handler_,
00431                       ACE_Sig_Handler,
00432                       -1);
00433 
00434       if (this->signal_handler_ == 0)
00435         result = -1;
00436       else
00437         this->delete_signal_handler_ = 1;
00438     }
00439 
00440   // Allows the timer queue to be overridden.
00441   if (result != -1 && this->timer_queue_ == 0)
00442     {
00443       ACE_NEW_RETURN (this->timer_queue_,
00444                       ACE_Timer_Heap,
00445                       -1);
00446 
00447       if (this->timer_queue_ == 0)
00448         result = -1;
00449       else
00450         this->delete_timer_queue_ = 1;
00451     }
00452 
00453   // Allows the Notify_Handler to be overridden.
00454   if (result != -1 && this->notify_handler_ == 0)
00455     {
00456       ACE_NEW_RETURN (this->notify_handler_,
00457                       ACE_Select_Reactor_Notify,
00458                       -1);
00459 
00460       if (this->notify_handler_ == 0)
00461         result = -1;
00462       else
00463         this->delete_notify_handler_ = 1;
00464     }
00465 
00466   if (result != -1 && this->handler_rep_.open (size) == -1)
00467     result = -1;
00468   else if (this->notify_handler_->open (this,
00469                                         0,
00470                                         disable_notify_pipe) == -1)
00471     result = -1;
00472 
00473   if (result != -1)
00474     // We're all set to go.
00475     this->initialized_ = 1;
00476   else
00477     // This will close down all the allocated resources properly.
00478     this->close ();
00479 
00480   return result;
00481 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>& ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::operator= const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &    [private]
 

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::owner ACE_thread_t   [virtual]
 

Return the current owner of the thread.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 114 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_thread_t, ACE_TRACE, and ACE_Select_Reactor_Impl::owner_.

00115 {
00116   ACE_TRACE ("ACE_Select_Reactor_T::owner");
00117   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00118   *t_id = this->owner_;
00119   return 0;
00120 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::owner ACE_thread_t    n_id,
ACE_thread_t   o_id = 0
[virtual]
 

Set the new owner of the thread and return the old owner.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 99 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_thread_t, ACE_TRACE, and ACE_Select_Reactor_Impl::owner_.

00101 {
00102   ACE_TRACE ("ACE_Select_Reactor_T::owner");
00103   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00104 
00105   if (o_id)
00106     *o_id = this->owner_;
00107 
00108   this->owner_ = tid;
00109 
00110   return 0;
00111 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ready_ops ACE_HANDLE    handle,
ACE_Reactor_Mask   ,
int    ops
[virtual]
 

GET/SET/ADD/CLR the ready "bit" bound with the <handle> and <mask>.

Implements ACE_Reactor_Impl.

Definition at line 391 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00394 {
00395   ACE_TRACE ("ACE_Select_Reactor_T::ready_ops");
00396   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00397   return this->bit_ops (handle,
00398                         mask,
00399                         this->ready_set_,
00400                         ops);
00401 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::ready_ops ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask,
int    ops
[virtual]
 

GET/SET/ADD/CLR the ready "bit" bound with the <eh> and <mask>.

Implements ACE_Reactor_Impl.

Definition at line 124 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, and ACE_Event_Handler::get_handle.

00127 {
00128   ACE_TRACE ("ACE_Select_Reactor_T::ready_ops");
00129   return this->ready_ops (handler->get_handle (), mask, ops);
00130 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler const ACE_Sig_Set   sigset,
ACE_Event_Handler   new_sh,
ACE_Sig_Action   new_disp = 0
[virtual]
 

Registers <new_sh> to handle a set of signals <sigset> using the <new_disp>.

Implements ACE_Reactor_Impl.

Definition at line 688 of file Select_Reactor_T.cpp.

References ACE_NSIG, and ACE_TRACE.

00691 {
00692   ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
00693 
00694   int result = 0;
00695 
00696 #if (ACE_NSIG > 0)  &&  !defined (CHORUS)
00697   for (int s = 1; s < ACE_NSIG; s++)
00698     if (sigset.is_member (s)
00699         && this->signal_handler_->register_handler (s,
00700                                                     new_sh,
00701                                                     new_disp) == -1)
00702       result = -1;
00703 #else  /* ACE_NSIG <= 0  ||  CHORUS */
00704   ACE_UNUSED_ARG (sigset);
00705   ACE_UNUSED_ARG (new_sh);
00706   ACE_UNUSED_ARG (new_disp);
00707 #endif /* ACE_NSIG <= 0  ||  CHORUS */
00708   return result;
00709 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::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]
 

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.

Implements ACE_Reactor_Impl.

Definition at line 53 of file Select_Reactor_T.i.

References ACE_TRACE, ACE_Sig_Handler::register_handler, and ACE_Select_Reactor_Impl::signal_handler_.

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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler const ACE_Handle_Set   handles,
ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

Register <eh> with all the <handles> in the <Handle_Set>.

Implements ACE_Reactor_Impl.

Definition at line 337 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00340 {
00341   ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
00342   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00343   return this->register_handler_i (handles, handler, mask);
00344 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler ACE_HANDLE    event_handle,
ACE_HANDLE    io_handle,
ACE_Event_Handler   event_handler,
ACE_Reactor_Mask    mask
[virtual]
 

Not implemented.

Implements ACE_Reactor_Impl.

Definition at line 80 of file Select_Reactor_T.i.

References ACE_Reactor_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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler ACE_Event_Handler   event_handler,
ACE_HANDLE    event_handle = ACE_INVALID_HANDLE
[virtual]
 

Not implemented.

Implements ACE_Reactor_Impl.

Definition at line 68 of file Select_Reactor_T.i.

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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler ACE_HANDLE    handle,
ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

Register a <eh> with a particular <mask>. Note that since the <handle> is given the Select_Reactor will *not* call <ACE_Event_Handler::get_handle> to extract the underlying I/O handle.

Implements ACE_Reactor_Impl.

Definition at line 326 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00329 {
00330   ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
00331   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00332   return this->register_handler_i (handle, handler, mask);
00333 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

Register a <eh> with a particular <mask>. Note that the <Select_Reactor> will call <ACE_Event_Handler::get_handle> to extract the underlying I/O handle.

Implements ACE_Reactor_Impl.

Definition at line 316 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00318 {
00319   ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
00320   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00321   return this->register_handler_i (handler->get_handle (), handler, mask);
00322 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler_i const ACE_Handle_Set   handles,
ACE_Event_Handler   handler,
ACE_Reactor_Mask    mask
[protected, virtual]
 

Register a set of <handles>.

Reimplemented in ACE_FlReactor.

Definition at line 671 of file Select_Reactor_T.cpp.

References ACE_Reactor_Mask, and ACE_TRACE.

00674 {
00675   ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i");
00676   ACE_HANDLE h;
00677 
00678   ACE_Handle_Set_Iterator handle_iter (handles);
00679   while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
00680     if (this->register_handler_i (h, handler, mask) == -1)
00681       return -1;
00682 
00683   return 0;
00684 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::register_handler_i ACE_HANDLE    handle,
ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[protected, virtual]
 

Do the work of actually binding the <handle> and <eh> with the <mask>.

Reimplemented in ACE_FlReactor.

Definition at line 976 of file Select_Reactor_T.cpp.

References ACE_Reactor_Mask, and ACE_TRACE.

00979 {
00980   ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i");
00981 
00982   // Insert the <handle, event_handle> tuple into the Handler
00983   // Repository.
00984   return this->handler_rep_.bind (handle, event_handler, mask);
00985 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::release_token void    [protected]
 

Release the token lock when a Win32 structured exception occurs.

Definition at line 1316 of file Select_Reactor_T.cpp.

References token_.

01317 {
01318 #if defined (ACE_WIN32)
01319   this->token_.release ();
01320   return (int) EXCEPTION_CONTINUE_SEARCH;
01321 #else
01322   return 0;
01323 #endif /* ACE_WIN32 */
01324 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler const ACE_Sig_Set   sigset [virtual]
 

Calls <remove_handler> for every signal in <sigset>.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 713 of file Select_Reactor_T.cpp.

References ACE_NSIG, and ACE_TRACE.

00714 {
00715   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00716   int result = 0;
00717 
00718 #if (ACE_NSIG > 0)  &&  !defined (CHORUS)
00719   for (int s = 1; s < ACE_NSIG; s++)
00720     if (sigset.is_member (s)
00721         && this->signal_handler_->remove_handler (s) == -1)
00722       result = -1;
00723 #else  /* ACE_NSIG <= 0  ||  CHORUS */
00724   ACE_UNUSED_ARG (sigset);
00725 #endif /* ACE_NSIG <= 0  ||  CHORUS */
00726 
00727   return result;
00728 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler int    signum,
ACE_Sig_Action   new_disp,
ACE_Sig_Action   old_disp = 0,
int    sigkey = -1
[virtual]
 

Remove the ACE_Event_Handler currently associated with <signum>. <sigkey> is ignored in this implementation since there is only one instance of a signal handler. 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.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 101 of file Select_Reactor_T.i.

References ACE_TRACE, ACE_Sig_Handler::remove_handler, and ACE_Select_Reactor_Impl::signal_handler_.

00105 {
00106   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00107   return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey);
00108 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler const ACE_Handle_Set   handle_set,
ACE_Reactor_Mask   
[virtual]
 

Removes all the <mask> bindings for handles in the <handle_set> bind of <Event_Handler>. If there are no more bindings for any of these handlers then they are removed from the Select_Reactor.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 359 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00361 {
00362   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00363   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00364   return this->remove_handler_i (handles, mask);
00365 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler ACE_HANDLE    handle,
ACE_Reactor_Mask   
[virtual]
 

Removes the <mask> bind of <Event_Handler> whose handle is <handle> from the Select_Reactor. If there are no more bindings for this <eh> then it is removed from the Select_Reactor.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 379 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00381 {
00382   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00383   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00384   return this->remove_handler_i (handle, mask);
00385 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

Removes the <mask> binding of <eh> from the Select_Reactor. If there are no more bindings for this <eh> then it is removed from the Select_Reactor. Note that the Select_Reactor will call <ACE_Event_Handler::get_handle> to extract the underlying I/O handle.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_TP_Reactor.

Definition at line 369 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_Reactor_Mask, and ACE_TRACE.

00371 {
00372   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
00373   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00374   return this->remove_handler_i (handler->get_handle (), mask);
00375 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler_i const ACE_Handle_Set   handles,
ACE_Reactor_Mask   
[protected, virtual]
 

Remove a set of <handles>.

Reimplemented in ACE_FlReactor.

Definition at line 654 of file Select_Reactor_T.cpp.

References ACE_Reactor_Mask, and ACE_TRACE.

00656 {
00657   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i");
00658   ACE_HANDLE h;
00659 
00660   ACE_Handle_Set_Iterator handle_iter (handles);
00661 
00662   while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
00663     if (this->remove_handler_i (h, mask) == -1)
00664       return -1;
00665 
00666   return 0;
00667 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler_i ACE_HANDLE    handle,
ACE_Reactor_Mask   
[protected, virtual]
 

Do the work of actually unbinding the <handle> and <eh> with the <mask>.

Reimplemented in ACE_FlReactor.

Definition at line 989 of file Select_Reactor_T.cpp.

References ACE_Reactor_Mask, and ACE_TRACE.

Referenced by check_handles.

00991 {
00992   ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i");
00993 
00994   // Unbind this handle.
00995   return this->handler_rep_.unbind (handle, mask);
00996 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::renew void    [protected, virtual]
 

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

Implements ACE_Select_Reactor_Impl.

Definition at line 179 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Select_Reactor_Impl::supress_notify_renew, and token_.

00180 {
00181   ACE_TRACE ("ACE_Select_Reactor_T::renew");
00182 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00183   if (this->supress_notify_renew () == 0)
00184     this->token_.renew (this->requeue_position_);
00185 #endif /* defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) */
00186 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::requeue_position void    [virtual]
 

Get position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a <notify> callback.

Implements ACE_Reactor_Impl.

Definition at line 153 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and ACE_Select_Reactor_Impl::requeue_position_.

00154 {
00155   ACE_TRACE ("ACE_Select_Reactor_T::requeue_position");
00156   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00157   return this->requeue_position_;
00158 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::requeue_position int    [virtual]
 

Set position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a <notify> callback.

Implements ACE_Reactor_Impl.

Definition at line 139 of file Select_Reactor_T.cpp.

References ACE_GUARD, ACE_MT, ACE_TRACE, and ACE_Select_Reactor_Impl::requeue_position_.

00140 {
00141   ACE_TRACE ("ACE_Select_Reactor_T::requeue_position");
00142   ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_));
00143 #if defined (ACE_WIN32)
00144   ACE_UNUSED_ARG (rp);
00145   // Must always requeue ourselves "next" on Win32.
00146   this->requeue_position_ = 0;
00147 #else
00148   this->requeue_position_ = rp;
00149 #endif /* ACE_WIN32 */
00150 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::reset_timer_interval long    timer_id,
const ACE_Time_Value   interval
[virtual]
 

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.

Implements ACE_Reactor_Impl.

Reimplemented in ACE_FlReactor.

Definition at line 778 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_TRACE.

00780 {
00781   ACE_TRACE ("ACE_Select_Reactor_T::reset_timer_interval");
00782   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00783 
00784   return this->timer_queue_->reset_interval (timer_id, interval);
00785 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::restart int    r [virtual]
 

Set a new value for restart and return the original value.

Implements ACE_Reactor_Impl.

Definition at line 130 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_Select_Reactor_Impl::restart_.

00131 {
00132   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00133   int current_value = this->restart_;
00134   this->restart_ = r;
00135   return current_value;
00136 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::restart void    [virtual]
 

Get the existing restart value.

Implements ACE_Reactor_Impl.

Definition at line 123 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_Select_Reactor_Impl::restart_.

00124 {
00125   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00126   return this->restart_;
00127 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handler const ACE_Handle_Set   handles [virtual]
 

Resume all <handles> in handle set.

Implements ACE_Reactor_Impl.

Definition at line 14 of file Select_Reactor_T.i.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and resume_i.

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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handler ACE_HANDLE    handle [virtual]
 

Resume a temporarily suspended <Event_Handler> associated with <handle>.

Implements ACE_Reactor_Impl.

Definition at line 267 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and resume_i.

00268 {
00269   ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
00270   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00271   return this->resume_i (handle);
00272 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handler ACE_Event_Handler   eh [virtual]
 

Resume a temporarily suspend <Event_Handler> associated with <eh>.

Implements ACE_Reactor_Impl.

Definition at line 7 of file Select_Reactor_T.i.

References ACE_TRACE, and ACE_Event_Handler::get_handle.

00008 {
00009   ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
00010   return this->resume_handler (h->get_handle ());
00011 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handlers void    [virtual]
 

Resume all the <Event_Handlers> in the Select_Reactor.

Implements ACE_Reactor_Impl.

Definition at line 299 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Select_Reactor_Handler_Repository_Iterator::advance, ACE_Event_Handler::get_handle, ACE_Select_Reactor_Handler_Repository_Iterator::next, and resume_i.

00300 {
00301   ACE_TRACE ("ACE_Select_Reactor_T::resume_handlers");
00302   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00303 
00304   ACE_Event_Handler *eh = 0;
00305 
00306   for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_);
00307        iter.next (eh) != 0;
00308        iter.advance ())
00309     this->resume_i (eh->get_handle ());
00310 
00311   return 0;
00312 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_i ACE_HANDLE    handle [protected, virtual]
 

Resume the <Event_Handler> associated with <handle>.

Definition at line 906 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Handle_Set::clr_bit, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::find, ACE_Select_Reactor_Impl::handler_rep_, ACE_Handle_Set::is_set, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Handle_Set::set_bit, ACE_Select_Reactor_Impl::suspend_set_, ACE_Select_Reactor_Impl::wait_set_, and ACE_Select_Reactor_Handle_Set::wr_mask_.

Referenced by resume_handler, and resume_handlers.

00907 {
00908   ACE_TRACE ("ACE_Select_Reactor_T::resume_i");
00909   if (this->handler_rep_.find (handle) == 0)
00910     return -1;
00911 
00912   if (this->suspend_set_.rd_mask_.is_set (handle))
00913     {
00914       this->wait_set_.rd_mask_.set_bit (handle);
00915       this->suspend_set_.rd_mask_.clr_bit (handle);
00916     }
00917   if (this->suspend_set_.wr_mask_.is_set (handle))
00918     {
00919       this->wait_set_.wr_mask_.set_bit (handle);
00920       this->suspend_set_.wr_mask_.clr_bit (handle);
00921     }
00922   if (this->suspend_set_.ex_mask_.is_set (handle))
00923     {
00924       this->wait_set_.ex_mask_.set_bit (handle);
00925       this->suspend_set_.ex_mask_.clr_bit (handle);
00926     }
00927   return 0;
00928 }

template<class ACE_SELECT_REACTOR_TOKEN>
long ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::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]
 

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.

See also:
cancel_timer() , reset_timer_interval()
Parameters:
event_handler  Event handler to schedule on reactor
arg  Argument passed to the handle_timeout() method of event_handler
delay  Time interval after which the timer will expire
interval  Time interval after which the timer will be automatically rescheduled
Returns:
-1 on failure, a timer_id value on success

Implements ACE_Reactor_Impl.

Reimplemented in ACE_FlReactor.

Definition at line 761 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_TRACE.

00765 {
00766   ACE_TRACE ("ACE_Select_Reactor_T::schedule_timer");
00767   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00768 
00769   return this->timer_queue_->schedule
00770     (handler,
00771      arg,
00772      timer_queue_->gettimeofday () + delay_time,
00773      interval);
00774 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::schedule_wakeup ACE_HANDLE    handle,
ACE_Reactor_Mask    mask
[virtual]
 

ADD the dispatch MASK "bit" bound with the <handle> and the <mask>.

Implements ACE_Reactor_Impl.

Definition at line 160 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor::ADD_MASK, and mask_ops.

00162 {
00163   ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
00164   return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK);
00165 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::schedule_wakeup ACE_Event_Handler   eh,
ACE_Reactor_Mask    mask
[virtual]
 

ADD the dispatch MASK "bit" bound with the <eh> and the <mask>.

Implements ACE_Reactor_Impl.

Definition at line 144 of file Select_Reactor_T.i.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor::ADD_MASK, ACE_Event_Handler::get_handle, and mask_ops.

00146 {
00147   ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
00148   return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK);
00149 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::set_sig_handler ACE_Sig_Handler   signal_handler [virtual]
 

Use a user specified signal handler instead.

Implements ACE_Reactor_Impl.

Definition at line 485 of file Select_Reactor_T.cpp.

00486 {
00487   if (this->signal_handler_ != 0 && this->delete_signal_handler_ != 0)
00488     delete this->signal_handler_;
00489   this->signal_handler_ = signal_handler;
00490   this->delete_signal_handler_ = 0;
00491   return 0;
00492 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::set_timer_queue ACE_Timer_Queue   tq [virtual]
 

Deprecated:
The following method is deprecated. Use <timer_queue> instead. Set a user specified timer queue.

Implements ACE_Reactor_Impl.

Definition at line 513 of file Select_Reactor_T.cpp.

00514 {
00515   return this->timer_queue (tq);
00516 }

template<class ACE_SELECT_REACTOR_TOKEN>
size_t ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::size void    const [virtual]
 

Returns the current size of the Reactor's internal descriptor table.

Implements ACE_Reactor_Impl.

Definition at line 216 of file Select_Reactor_T.i.

References ACE_Select_Reactor_Impl::handler_rep_, and ACE_Select_Reactor_Handler_Repository::size.

00217 {
00218   return this->handler_rep_.size ();
00219 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handler const ACE_Handle_Set   handles [virtual]
 

Suspend all <handles> in handle set temporarily.

Implements ACE_Reactor_Impl.

Definition at line 37 of file Select_Reactor_T.i.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and suspend_i.

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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handler ACE_HANDLE    handle [virtual]
 

Temporarily suspend the <Event_Handler> associated with <handle>.

Implements ACE_Reactor_Impl.

Definition at line 275 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, and suspend_i.

00276 {
00277   ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
00278   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00279   return this->suspend_i (handle);
00280 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handler ACE_Event_Handler   eh [virtual]
 

Temporarily suspend the <Event_Handler> associated with <eh>.

Implements ACE_Reactor_Impl.

Definition at line 30 of file Select_Reactor_T.i.

References ACE_TRACE, and ACE_Event_Handler::get_handle.

00031 {
00032   ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
00033   return this->suspend_handler (h->get_handle ());
00034 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handlers void    [virtual]
 

Suspend all the <Event_Handlers> in the Select_Reactor.

Implements ACE_Reactor_Impl.

Definition at line 283 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Select_Reactor_Handler_Repository_Iterator::advance, ACE_Event_Handler::get_handle, ACE_Select_Reactor_Handler_Repository_Iterator::next, and suspend_i.

00284 {
00285   ACE_TRACE ("ACE_Select_Reactor_T::suspend_handlers");
00286   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
00287 
00288   ACE_Event_Handler *eh = 0;
00289 
00290   for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_);
00291        iter.next (eh) != 0;
00292        iter.advance ())
00293     this->suspend_i (eh->get_handle ());
00294 
00295   return 0;
00296 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_i ACE_HANDLE    handle [protected, virtual]
 

Suspend the <Event_Handler> associated with <handle>.

Definition at line 933 of file Select_Reactor_T.cpp.

References ACE_TRACE, ACE_Handle_Set::clr_bit, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::find, ACE_Select_Reactor_Impl::handler_rep_, ACE_Handle_Set::is_set, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Handle_Set::set_bit, ACE_Select_Reactor_Impl::suspend_set_, ACE_Select_Reactor_Impl::wait_set_, and ACE_Select_Reactor_Handle_Set::wr_mask_.

Referenced by suspend_handler, and suspend_handlers.

00934 {
00935   ACE_TRACE ("ACE_Select_Reactor_T::suspend_i");
00936   if (this->handler_rep_.find (handle) == 0)
00937     return -1;
00938 
00939   if (this->wait_set_.rd_mask_.is_set (handle))
00940     {
00941       this->suspend_set_.rd_mask_.set_bit (handle);
00942       this->wait_set_.rd_mask_.clr_bit (handle);
00943     }
00944   if (this->wait_set_.wr_mask_.is_set (handle))
00945     {
00946       this->suspend_set_.wr_mask_.set_bit (handle);
00947       this->wait_set_.wr_mask_.clr_bit (handle);
00948     }
00949   if (this->wait_set_.ex_mask_.is_set (handle))
00950     {
00951       this->suspend_set_.ex_mask_.set_bit (handle);
00952       this->wait_set_.ex_mask_.clr_bit (handle);
00953     }
00954   return 0;
00955 }

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Timer_Queue * ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::timer_queue void    const [virtual]
 

Return the current <ACE_Timer_Queue>.

Implements ACE_Reactor_Impl.

Definition at line 495 of file Select_Reactor_T.cpp.

References ACE_Select_Reactor_Impl::timer_queue_.

00496 {
00497   return this->timer_queue_;
00498 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::timer_queue ACE_Timer_Queue   tq [virtual]
 

Set a user-specified timer queue.

Implements ACE_Reactor_Impl.

Definition at line 502 of file Select_Reactor_T.cpp.

00503 {
00504   if (this->timer_queue_ != 0 && this->delete_timer_queue_ != 0)
00505     delete this->timer_queue_;
00506   this->timer_queue_ = tq;
00507   this->delete_timer_queue_ = 0;
00508   return 0;
00509 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::uses_event_associations void    [virtual]
 

Return 1 if we any event associations were made by the reactor for the handles that it waits on, 0 otherwise. Since the Select_Reactor does not do any event associations, this function always return 0.

Implements ACE_Reactor_Impl.

Definition at line 111 of file Select_Reactor_T.i.

00112 {
00113   // Since the Select_Reactor does not do any event associations, this
00114   // function always return 0.
00115   return 0;
00116 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::wait_for_multiple_events ACE_Select_Reactor_Handle_Set  ,
ACE_Time_Value  
[protected, virtual]
 

Wait for events to occur.

Reimplemented in ACE_FlReactor.

Definition at line 1040 of file Select_Reactor_T.cpp.

References ACE_TRACE, and ACE_OS::select.

01042 {
01043   ACE_TRACE ("ACE_Select_Reactor_T::wait_for_multiple_events");
01044   u_long width = 0;
01045   ACE_Time_Value timer_buf (0);
01046   ACE_Time_Value *this_timeout;
01047 
01048   int number_of_active_handles = this->any_ready (dispatch_set);
01049 
01050   // If there are any bits enabled in the <ready_set_> then we'll
01051   // handle those first, otherwise we'll block in <select>.
01052 
01053   if (number_of_active_handles == 0)
01054     {
01055       do
01056         {
01057           this_timeout =
01058             this->timer_queue_->calculate_timeout (max_wait_time,
01059                                                    &timer_buf);
01060           width = (u_long) this->handler_rep_.max_handlep1 ();
01061 
01062           dispatch_set.rd_mask_ = this->wait_set_.rd_mask_;
01063           dispatch_set.wr_mask_ = this->wait_set_.wr_mask_;
01064           dispatch_set.ex_mask_ = this->wait_set_.ex_mask_;
01065           number_of_active_handles = ACE_OS::select (int (width),
01066                                                      dispatch_set.rd_mask_,
01067                                                      dispatch_set.wr_mask_,
01068                                                      dispatch_set.ex_mask_,
01069                                                      this_timeout);
01070         }
01071       while (number_of_active_handles == -1 && this->handle_error () > 0);
01072 
01073       if (number_of_active_handles > 0)
01074         {
01075 #if !defined (ACE_WIN32)
01076           // Resynchronize the fd_sets so their "max" is set properly.
01077           dispatch_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ());
01078           dispatch_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ());
01079           dispatch_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ());
01080 #endif /* ACE_WIN32 */
01081         }
01082       else if (number_of_active_handles == -1)
01083         {
01084           // Normally, select() will reset the bits in dispatch_set
01085           // so that only those filed descriptors that are ready will
01086           // have bits set.  However, when an error occurs, the bit
01087           // set remains as it was when the select call was first made.
01088           // Thus, we now have a dispatch_set that has every file
01089           // descriptor that was originally waited for, which is not
01090           // correct.  We must clear all the bit sets because we
01091           // have no idea if any of the file descriptors is ready.
01092           //
01093           // NOTE: We dont have a test case to reproduce this
01094           // problem. But pleae dont ignore this and remove it off.
01095           dispatch_set.rd_mask_.reset ();
01096           dispatch_set.wr_mask_.reset ();
01097           dispatch_set.ex_mask_.reset ();
01098         }
01099     }
01100 
01101   // Return the number of events to dispatch.
01102   return number_of_active_handles;
01103 }

template<class ACE_SELECT_REACTOR_TOKEN>
void ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::wakeup_all_threads void    [virtual]
 

Wake up all threads in waiting in the event loop.

Implements ACE_Reactor_Impl.

Definition at line 183 of file Select_Reactor_T.i.

References notify, ACE_Event_Handler::NULL_MASK, and ACE_Time_Value::zero.

Referenced by deactivate.

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 }

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::work_pending const ACE_Time_Value   max_wait_time = ACE_Time_Value::zero [virtual]
 

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".

Implements ACE_Reactor_Impl.

Definition at line 1000 of file Select_Reactor_T.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_OS::select, and ACE_Select_Reactor_Handle_Set::wr_mask_.

01001 {
01002   ACE_TRACE ("ACE_Select_Reactor_T::work_pending");
01003 
01004   ACE_Time_Value mwt (max_wait_time);
01005   ACE_MT (ACE_Countdown_Time countdown (&mwt));
01006 
01007   ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN,
01008                             ace_mon,
01009                             this->token_,
01010                             -1));
01011 
01012   if (this->deactivated_)
01013     return 0;
01014 
01015   // Update the countdown to reflect time waiting for the mutex.
01016   ACE_MT (countdown.update ());
01017 
01018   ACE_Time_Value timer_buf (0);
01019   ACE_Time_Value *this_timeout =
01020     this->timer_queue_->calculate_timeout (&mwt, &timer_buf);
01021 
01022   u_long width = (u_long) this->handler_rep_.max_handlep1 ();
01023 
01024   ACE_Select_Reactor_Handle_Set fd_set;
01025   fd_set.rd_mask_ = this->wait_set_.rd_mask_;
01026   fd_set.wr_mask_ = this->wait_set_.wr_mask_;
01027   fd_set.ex_mask_ = this->wait_set_.ex_mask_;
01028 
01029   return ACE_OS::select (int (width),
01030                          fd_set.rd_mask_,
01031                          fd_set.wr_mask_,
01032                          fd_set.ex_mask_,
01033                          this_timeout);
01034 }


Member Data Documentation

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Select_Reactor_T::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Reactor_Impl.

Reimplemented in ACE_Priority_Reactor.

Definition at line 599 of file Select_Reactor_T.h.

template<class ACE_SELECT_REACTOR_TOKEN>
sig_atomic_t ACE_Select_Reactor_T::deactivated_ [protected]
 

This flag is used to keep track of whether we are actively handling events or not.

Definition at line 746 of file Select_Reactor_T.h.

Referenced by deactivate, and deactivated.

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_Lock_Adapter<ACE_SELECT_REACTOR_TOKEN> ACE_Select_Reactor_T::lock_adapter_ [protected]
 

Adapter used to return internal lock to outside world.

Definition at line 736 of file Select_Reactor_T.h.

Referenced by lock.

template<class ACE_SELECT_REACTOR_TOKEN>
int ACE_Select_Reactor_T::mask_signals_ [protected]
 

If 0 then the Reactor will not mask the signals during the event dispatching. This is useful for applications that do not register any signal handlers and want to reduce the overhead introduce by the kernel level locks required to change the mask.

Definition at line 754 of file Select_Reactor_T.h.

template<class ACE_SELECT_REACTOR_TOKEN>
ACE_SELECT_REACTOR_TOKEN ACE_Select_Reactor_T::token_ [protected]
 

Synchronization token for the MT_SAFE ACE_Select_Reactor.

Definition at line 733 of file Select_Reactor_T.h.

Referenced by dump, release_token, and renew.


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