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

ACE_TkReactor Class Reference

An object-oriented event demultiplexor and event handler dispatcher that uses the Tk functions. More...

#include <TkReactor.h>

Inheritance diagram for ACE_TkReactor:

Inheritance graph
[legend]
Collaboration diagram for ACE_TkReactor:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_TkReactor (size_t size=DEFAULT_SIZE, int restart=0, ACE_Sig_Handler *=0)
virtual ~ACE_TkReactor (void)
virtual long schedule_timer (ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, const ACE_Time_Value &interval)
virtual int reset_timer_interval (long timer_id, const ACE_Time_Value &interval)
virtual int cancel_timer (ACE_Event_Handler *handler, int dont_call_handle_close=1)
 Cancel all Event_Handlers that match the address of <event_handler>. Returns number of handlers cancelled. More...

virtual int cancel_timer (long timer_id, const void **arg=0, int dont_call_handle_close=1)

Protected Methods

virtual int register_handler_i (ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask)
 Register a single <handler>. More...

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

virtual int remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask)
 Remove the <handler> associated with this <handle>. More...

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

virtual void remove_TkFileHandler (ACE_HANDLE handle)
 Removes an Tk FileHandler. More...

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

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


Protected Attributes

ACE_TkReactorIDids_
Tk_TimerToken timeout_

Private Methods

void reset_timeout (void)
 This method ensures there's a Tk timeout for the first timeout in the Reactor's Timer_Queue. More...

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

ACE_TkReactor & operator= (const ACE_TkReactor &)

Static Private Methods

void TimerCallbackProc (ClientData cd)
void InputCallbackProc (ClientData cd, int mask)

Detailed Description

An object-oriented event demultiplexor and event handler dispatcher that uses the Tk functions.

Definition at line 59 of file TkReactor.h.


Constructor & Destructor Documentation

ACE_TkReactor::ACE_TkReactor size_t    size = DEFAULT_SIZE,
int    restart = 0,
ACE_Sig_Handler   = 0
 

Definition at line 14 of file TkReactor.cpp.

References ACE_Reactor_Notify::close, ACE_Select_Reactor_Impl::notify_handler_, and ACE_Reactor_Notify::open.

00017   : ACE_Select_Reactor (size, restart, h),
00018     ids_ (0),
00019     timeout_ (0)
00020 {
00021   // When the ACE_Select_Reactor is constructed it creates the notify
00022   // pipe and registers it with the register_handler_i() method. The
00023   // TkReactor overloads this method BUT because the
00024   // register_handler_i occurs when constructing the base class
00025   // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i()
00026   // is called not the TkReactor register_handler_i().  This means
00027   // that the notify pipe is registered with the ACE_Select_Reactor
00028   // event handling code not the TkReactor and so notfications don't
00029   // work.  To get around this we simply close and re-opened the
00030   // notification handler in the constructor of the TkReactor.
00031 
00032 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00033   this->notify_handler_->close ();
00034   this->notify_handler_->open (this, 0);
00035 #endif /* ACE_MT_SAFE */
00036 }

ACE_TkReactor::~ACE_TkReactor void    [virtual]
 

Definition at line 38 of file TkReactor.cpp.

References ids_, and ACE_TkReactorID::next_.

00039 {
00040   // Delete the remaining items in the linked list.
00041 
00042   while (this->ids_)
00043     {
00044       ACE_TkReactorID *TkID = this->ids_->next_;
00045       delete this->ids_;
00046       this->ids_ = TkID;
00047     }
00048 }

ACE_TkReactor::ACE_TkReactor const ACE_TkReactor &    [private]
 

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


Member Function Documentation

int ACE_TkReactor::cancel_timer long    timer_id,
const void **    arg = 0,
int    dont_call_handle_close = 1
[virtual]
 

Cancel the single 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. Returns 1 if cancellation succeeded and 0 if the <timer_id> wasn't found.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 423 of file TkReactor.cpp.

References ACE_TRACE, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::cancel_timer, and reset_timeout.

00426 {
00427   ACE_TRACE ("ACE_TkReactor::cancel_timer");
00428 
00429   if (ACE_Select_Reactor::cancel_timer (timer_id,
00430                                         arg,
00431                                         dont_call_handle_close) == -1)
00432     return -1;
00433   else
00434     {
00435       this->reset_timeout ();
00436       return 0;
00437     }
00438 }

int ACE_TkReactor::cancel_timer ACE_Event_Handler   handler,
int    dont_call_handle_close = 1
[virtual]
 

Cancel all Event_Handlers that match the address of <event_handler>. Returns number of handlers cancelled.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 407 of file TkReactor.cpp.

References ACE_TRACE, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::cancel_timer, and reset_timeout.

00409 {
00410   ACE_TRACE ("ACE_TkReactor::cancel_timer");
00411 
00412   if (ACE_Select_Reactor::cancel_timer (handler,
00413                                         dont_call_handle_close) == -1)
00414     return -1;
00415   else
00416     {
00417       this->reset_timeout ();
00418       return 0;
00419     }
00420 }

void ACE_TkReactor::InputCallbackProc ClientData    cd,
int    mask
[static, private]
 

Todo:
the unused mask argument is probably quite useful, but we ignore it, why? In fact the following comment probably relates to that: This could be made shorter if we know which *kind* of event we were about to get. Here we use <select> to find out which one might be available.

Definition at line 106 of file TkReactor.cpp.

References ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::dispatch, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_TkReactor_Input_Callback::handle_, ACE_Handle_Set::is_set, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_TkReactor_Input_Callback::reactor_, ACE_OS::select, ACE_Handle_Set::set_bit, ACE_Select_Reactor_Impl::wait_set_, ACE_Select_Reactor_Handle_Set::wr_mask_, and ACE_Time_Value::zero.

Referenced by register_handler_i.

00108 {
00109   ACE_TkReactor_Input_Callback *callback = (ACE_TkReactor_Input_Callback *) cd;
00110   ACE_TkReactor *self = callback->reactor_;
00111   ACE_HANDLE handle = callback->handle_;
00112 
00113   // my copy isn't const.
00114   ACE_Time_Value zero = ACE_Time_Value::zero;
00115 
00116   ACE_Select_Reactor_Handle_Set wait_set;
00117 
00118   // Deal with one file event.
00119 
00120   // - read which kind of event
00121   if (self->wait_set_.rd_mask_.is_set (handle))
00122     wait_set.rd_mask_.set_bit (handle);
00123   if (self->wait_set_.wr_mask_.is_set (handle))
00124     wait_set.wr_mask_.set_bit (handle);
00125   if (self->wait_set_.ex_mask_.is_set (handle))
00126     wait_set.ex_mask_.set_bit (handle);
00127 
00128   int result = ACE_OS::select (handle + 1,
00129                                wait_set.rd_mask_,
00130                                wait_set.wr_mask_,
00131                                wait_set.ex_mask_, &zero);
00132 
00133   ACE_Select_Reactor_Handle_Set dispatch_set;
00134 
00135   // - Use only that one file event (removes events for other files).
00136   if (result > 0)
00137     {
00138       if (wait_set.rd_mask_.is_set (handle))
00139         dispatch_set.rd_mask_.set_bit (handle);
00140       if (wait_set.wr_mask_.is_set (handle))
00141         dispatch_set.wr_mask_.set_bit (handle);
00142       if (wait_set.ex_mask_.is_set (handle))
00143         dispatch_set.ex_mask_.set_bit (handle);
00144 
00145       self->dispatch (1, dispatch_set);
00146     }
00147 }

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

int ACE_TkReactor::register_handler_i const ACE_Handle_Set   handles,
ACE_Event_Handler   handler,
ACE_Reactor_Mask    mask
[protected, virtual]
 

Register a set of <handlers>.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 272 of file TkReactor.cpp.

References ACE_Reactor_Mask, and ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::register_handler_i.

00275 {
00276   return ACE_Select_Reactor::register_handler_i (handles,
00277                                                  handler,
00278                                                  mask);
00279 }

int ACE_TkReactor::register_handler_i ACE_HANDLE    handle,
ACE_Event_Handler   handler,
ACE_Reactor_Mask    mask
[protected, virtual]
 

Register a single <handler>.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 183 of file TkReactor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_BIT_ENABLED, ACE_NEW_RETURN, ACE_Reactor_Mask, ACE_SET_BITS, ACE_TRACE, ACE_Event_Handler::CONNECT_MASK, ACE_Event_Handler::EXCEPT_MASK, ACE_TkReactor_Input_Callback::handle_, ACE_TkReactorID::handle_, ids_, InputCallbackProc, ACE_TkReactorID::next_, ACE_TkReactor_Input_Callback::reactor_, ACE_Event_Handler::READ_MASK, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::register_handler_i, and ACE_Event_Handler::WRITE_MASK.

00186 {
00187   ACE_TRACE ("ACE_TkReactor::register_handler_i");
00188 
00189   int result = ACE_Select_Reactor::register_handler_i (handle,
00190                                                        handler, mask);
00191   if (result == -1)
00192     return -1;
00193 
00194   int condition = 0;
00195 
00196 #if !defined ACE_WIN32
00197   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK))
00198     ACE_SET_BITS (condition, TK_READABLE);
00199   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK))
00200     ACE_SET_BITS (condition, TK_WRITABLE);
00201   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
00202     ACE_SET_BITS (condition, TK_EXCEPTION);
00203   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
00204     ACE_SET_BITS (condition, TK_READABLE);
00205   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){
00206       ACE_SET_BITS (condition, TK_READABLE); // connected, you may write
00207       ACE_SET_BITS (condition, TK_WRITABLE);  // connected, you have data/err
00208   }
00209 #else
00210   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK))
00211     ACE_SET_BITS (condition, TK_READABLE);
00212   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK))
00213     ACE_SET_BITS (condition, TK_WRITABLE);
00214   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
00215     ACE_NOTSUP_RETURN(-1);
00216   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
00217     ACE_SET_BITS (condition, TK_READABLE);
00218   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){
00219       ACE_SET_BITS (condition, TK_READABLE); // connected, you may write
00220       ACE_SET_BITS (condition, TK_WRITABLE);  // connected, you have data/err
00221   }
00222 #endif /* !ACE_WIN32 */
00223 
00224   if (condition != 0)
00225     {
00226       ACE_TkReactorID *TkID = this->ids_;
00227 
00228       while(TkID)
00229         {
00230           if (TkID->handle_ == handle)
00231             {
00232               ::Tk_DeleteFileHandler (TkID->handle_);
00233 
00234               ACE_TkReactor_Input_Callback *callback;
00235               ACE_NEW_RETURN (callback,
00236                               ACE_TkReactor_Input_Callback,
00237                               -1);
00238               callback->reactor_ = this;
00239               callback->handle_ = handle;
00240               ::Tk_CreateFileHandler ((int) handle,
00241                                       condition,
00242                                       InputCallbackProc,
00243                                       (ClientData) callback);
00244               return 0;
00245             }
00246           else
00247             TkID = TkID->next_;
00248         }
00249 
00250       ACE_NEW_RETURN (TkID,
00251                       ACE_TkReactorID,
00252                       -1);
00253       TkID->next_ = this->ids_;
00254       TkID->handle_ = handle;
00255       ACE_TkReactor_Input_Callback *callback;
00256       ACE_NEW_RETURN (callback,
00257                       ACE_TkReactor_Input_Callback,
00258                       -1);
00259       callback->reactor_ = this;
00260       callback->handle_ = handle;
00261 
00262       ::Tk_CreateFileHandler ((int) handle,
00263                               condition,
00264                               InputCallbackProc,
00265                               (ClientData) callback);
00266       this->ids_ = TkID;
00267     }
00268   return 0;
00269 }

int ACE_TkReactor::remove_handler_i const ACE_Handle_Set   handles,
ACE_Reactor_Mask   
[protected, virtual]
 

Remove a set of <handles>.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 337 of file TkReactor.cpp.

References ACE_Reactor_Mask, and ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::remove_handler_i.

00339 {
00340   return ACE_Select_Reactor::remove_handler_i (handles,
00341                                                mask);
00342 }

int ACE_TkReactor::remove_handler_i ACE_HANDLE    handle,
ACE_Reactor_Mask    mask
[protected, virtual]
 

Remove the <handler> associated with this <handle>.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 282 of file TkReactor.cpp.

References ACE_Reactor_Mask, ACE_TRACE, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::remove_handler_i, and remove_TkFileHandler.

00284 {
00285   ACE_TRACE ("ACE_TkReactor::remove_handler_i");
00286 
00287   // In the registration phase we registered first with
00288   // ACE_Select_Reactor and then with X.  Now we are now doing things
00289   // in reverse order.
00290 
00291   // First clean up the corresponding X11Input.
00292   this->remove_TkFileHandler (handle);
00293 
00294   // Now let the reactor do its work.
00295   return ACE_Select_Reactor::remove_handler_i (handle,
00296                                                mask);
00297 }

void ACE_TkReactor::remove_TkFileHandler ACE_HANDLE    handle [protected, virtual]
 

Removes an Tk FileHandler.

Definition at line 300 of file TkReactor.cpp.

References ACE_TRACE, ACE_TkReactorID::handle_, ids_, and ACE_TkReactorID::next_.

Referenced by remove_handler_i.

00301 {
00302   ACE_TRACE ("ACE_TkReactor::remove_TkFileHandler");
00303 
00304   ACE_TkReactorID *TkID = this->ids_;
00305 
00306   if (TkID)
00307     {
00308       if (TkID->handle_ == handle)
00309         {
00310           ::Tk_DeleteFileHandler (TkID->handle_);
00311           this->ids_ = TkID->next_;
00312           delete TkID;
00313           return;
00314         }
00315 
00316       ACE_TkReactorID *NextID = TkID->next_;
00317 
00318       while (NextID)
00319         {
00320           if (NextID->handle_ == handle)
00321             {
00322               ::Tk_DeleteFileHandler (NextID->handle_);
00323               TkID->next_ = NextID->next_;
00324               delete NextID;
00325               return;
00326             }
00327           else
00328             {
00329               TkID = NextID;
00330               NextID = NextID->next_;
00331             }
00332         }
00333     }
00334 }

void ACE_TkReactor::reset_timeout void    [private]
 

This method ensures there's a Tk timeout for the first timeout in the Reactor's Timer_Queue.

Definition at line 348 of file TkReactor.cpp.

References ACE_Timer_Queue_T< ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall< ACE_SYNCH_RECURSIVE_MUTEX >, ACE_SYNCH_RECURSIVE_MUTEX >::calculate_timeout, ACE_Time_Value::msec, timeout_, ACE_Select_Reactor_Impl::timer_queue_, and TimerCallbackProc.

Referenced by cancel_timer, schedule_timer, and TimerCallbackProc.

00349 {
00350   if (this->timeout_)
00351     ::Tk_DeleteTimerHandler (this->timeout_);
00352   timeout_ = 0;
00353 
00354   ACE_Time_Value *max_wait_time =
00355     this->timer_queue_->calculate_timeout (0);
00356 
00357   if (max_wait_time)
00358     timeout_ = ::Tk_CreateTimerHandler (max_wait_time->msec (),
00359                                         TimerCallbackProc,
00360                                         (ClientData) this);
00361 }

int ACE_TkReactor::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.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 365 of file TkReactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_TRACE.

00367 {
00368   ACE_TRACE ("ACE_TkReactor::reset_timer_interval");
00369   ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
00370 
00371   int result = ACE_Select_Reactor::timer_queue_->reset_interval
00372     (timer_id,
00373      interval);
00374 
00375   if (result == -1)
00376     return -1;
00377   else
00378     {
00379       this->reset_timeout ();
00380       return result;
00381     }
00382 }

long ACE_TkReactor::schedule_timer ACE_Event_Handler   event_handler,
const void *    arg,
const ACE_Time_Value   delay,
const ACE_Time_Value   interval
[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

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 385 of file TkReactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, reset_timeout, and ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::schedule_timer.

00389 {
00390   ACE_TRACE ("ACE_TkReactor::schedule_timer");
00391   ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
00392 
00393   long result = ACE_Select_Reactor::schedule_timer (event_handler,
00394                                                     arg,
00395                                                     delay,
00396                                                     interval);
00397   if (result == -1)
00398     return -1;
00399   else
00400     {
00401       this->reset_timeout ();
00402       return result;
00403     }
00404 }

void ACE_TkReactor::TimerCallbackProc ClientData    cd [static, private]
 

Definition at line 86 of file TkReactor.cpp.

References ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::dispatch, reset_timeout, and timeout_.

Referenced by reset_timeout.

00087 {
00088   ACE_TkReactor *self = (ACE_TkReactor *) cd;
00089   self->timeout_ = 0;
00090 
00091   // Deal with any timer events
00092   ACE_Select_Reactor_Handle_Set handle_set;
00093   self->dispatch (0, handle_set);
00094   self->reset_timeout ();
00095 }

int ACE_TkReactor::TkWaitForMultipleEvents int   ,
ACE_Select_Reactor_Handle_Set  ,
ACE_Time_Value  
[protected, virtual]
 

Wait for Tk events to occur.

Definition at line 150 of file TkReactor.cpp.

References ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Impl::handler_rep_, ACE_Select_Reactor_Handler_Repository::max_handlep1, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_OS::select, ACE_Select_Reactor_Handle_Set::wr_mask_, and ACE_Time_Value::zero.

Referenced by wait_for_multiple_events.

00153 {
00154   // Check to make sure our handle's are all usable.
00155   ACE_Select_Reactor_Handle_Set temp_set = wait_set;
00156 
00157   if (ACE_OS::select (width,
00158                       temp_set.rd_mask_,
00159                       temp_set.wr_mask_,
00160                       temp_set.ex_mask_,
00161                       (ACE_Time_Value *) &ACE_Time_Value::zero) == -1)
00162     return -1; // Bad file arguments...
00163 
00164   // Instead of waiting using <select>, just use the Tk mechanism to
00165   // wait for a single event.
00166 
00167   // Wait for something to happen.
00168   ::Tcl_DoOneEvent (0);
00169 
00170   // Reset the width, in case it changed during the upcalls.
00171   width = this->handler_rep_.max_handlep1 ();
00172 
00173   // Now actually read the result needed by the <Select_Reactor> using
00174   // <select>.
00175   return ACE_OS::select (width,
00176                          wait_set.rd_mask_,
00177                          wait_set.wr_mask_,
00178                          wait_set.ex_mask_,
00179                          (ACE_Time_Value *) &ACE_Time_Value::zero);
00180 }

int ACE_TkReactor::wait_for_multiple_events ACE_Select_Reactor_Handle_Set  ,
ACE_Time_Value  
[protected, virtual]
 

Wait for events to occur.

Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.

Definition at line 54 of file TkReactor.cpp.

References ACE_TRACE, ACE_Timer_Queue_T< ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall< ACE_SYNCH_RECURSIVE_MUTEX >, ACE_SYNCH_RECURSIVE_MUTEX >::calculate_timeout, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::handle_error, ACE_Select_Reactor_Impl::handler_rep_, ACE_Select_Reactor_Handler_Repository::max_handlep1, ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Handle_Set::sync, ACE_Select_Reactor_Impl::timer_queue_, TkWaitForMultipleEvents, ACE_Select_Reactor_Impl::wait_set_, and ACE_Select_Reactor_Handle_Set::wr_mask_.

00056 {
00057   ACE_TRACE ("ACE_TkReactor::wait_for_multiple_events");
00058   int nfound;
00059 
00060   do
00061     {
00062       max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time);
00063 
00064       size_t width = this->handler_rep_.max_handlep1 ();
00065       handle_set.rd_mask_ = this->wait_set_.rd_mask_;
00066       handle_set.wr_mask_ = this->wait_set_.wr_mask_;
00067       handle_set.ex_mask_ = this->wait_set_.ex_mask_;
00068       nfound = TkWaitForMultipleEvents (width,
00069                                         handle_set,
00070                                         max_wait_time);
00071 
00072     } while (nfound == -1 && this->handle_error () > 0);
00073 
00074   if (nfound > 0)
00075     {
00076 #if !defined (ACE_WIN32)
00077       handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ());
00078       handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ());
00079       handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ());
00080 #endif /* ACE_WIN32 */
00081     }
00082   return nfound; // Timed out or input available
00083 }


Member Data Documentation

ACE_TkReactorID* ACE_TkReactor::ids_ [protected]
 

Definition at line 114 of file TkReactor.h.

Referenced by register_handler_i, remove_TkFileHandler, and ~ACE_TkReactor.

Tk_TimerToken ACE_TkReactor::timeout_ [protected]
 

Definition at line 115 of file TkReactor.h.

Referenced by reset_timeout, and TimerCallbackProc.


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