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

ACE_XtReactor Class Reference

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

#include <XtReactor.h>

Inheritance diagram for ACE_XtReactor:

Inheritance graph
[legend]
Collaboration diagram for ACE_XtReactor:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_XtReactor (XtAppContext context=0, size_t size=DEFAULT_SIZE, int restart=0, ACE_Sig_Handler *=0)
virtual ~ACE_XtReactor (void)
XtAppContext context (void) const
void context (XtAppContext)
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_XtInput (ACE_HANDLE handle)
 Removes an Xt handle. More...

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

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


Protected Attributes

XtAppContext context_
ACE_XtReactorIDids_
XtIntervalId timeout_

Private Methods

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

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

ACE_XtReactor & operator= (const ACE_XtReactor &)

Static Private Methods

void TimerCallbackProc (XtPointer closure, XtIntervalId *id)
void InputCallbackProc (XtPointer closure, int *source, XtInputId *id)

Detailed Description

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

Definition at line 59 of file XtReactor.h.


Constructor & Destructor Documentation

ACE_XtReactor::ACE_XtReactor XtAppContext    context = 0,
size_t    size = DEFAULT_SIZE,
int    restart = 0,
ACE_Sig_Handler   = 0
 

Definition at line 16 of file XtReactor.cpp.

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

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

ACE_XtReactor::~ACE_XtReactor void    [virtual]
 

Definition at line 42 of file XtReactor.cpp.

References ids_, and ACE_XtReactorID::next_.

00043 {
00044   // Delete the remaining items in the linked list.
00045 
00046   while (this->ids_)
00047     {
00048       ACE_XtReactorID *XtID = this->ids_->next_;
00049       delete this->ids_;
00050       this->ids_ = XtID;
00051     }
00052 }

ACE_XtReactor::ACE_XtReactor const ACE_XtReactor &    [private]
 

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


Member Function Documentation

int ACE_XtReactor::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 434 of file XtReactor.cpp.

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

00437 {
00438   ACE_TRACE ("ACE_XtReactor::cancel_timer");
00439 
00440   if (ACE_Select_Reactor::cancel_timer (timer_id,
00441                                         arg,
00442                                         dont_call_handle_close) == -1)
00443     return -1;
00444   else
00445     {
00446       this->reset_timeout ();
00447       return 0;
00448     }
00449 }

int ACE_XtReactor::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 418 of file XtReactor.cpp.

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

00420 {
00421   ACE_TRACE ("ACE_XtReactor::cancel_timer");
00422 
00423   if (ACE_Select_Reactor::cancel_timer (handler,
00424                                         dont_call_handle_close) == -1)
00425     return -1;
00426   else
00427     {
00428       this->reset_timeout ();
00429       return 0;
00430     }
00431 }

void ACE_XtReactor::context XtAppContext   
 

Definition at line 192 of file XtReactor.cpp.

References context, and context_.

00193 {
00194   this->context_ = context;
00195 }

XtAppContext ACE_XtReactor::context void    const
 

Definition at line 186 of file XtReactor.cpp.

References context_.

Referenced by context.

00187 {
00188   return this->context_;
00189 }

void ACE_XtReactor::InputCallbackProc XtPointer    closure,
int *    source,
XtInputId *    id
[static, private]
 

Definition at line 106 of file XtReactor.cpp.

References ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::dispatch, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Handle_Set::is_set, ACE_Select_Reactor_Handle_Set::rd_mask_, 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.

00109 {
00110   ACE_XtReactor *self = (ACE_XtReactor *) closure;
00111   ACE_HANDLE handle = (ACE_HANDLE) *source;
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 (*source + 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_XtReactor& ACE_XtReactor::operator= const ACE_XtReactor &    [private]
 

int ACE_XtReactor::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 279 of file XtReactor.cpp.

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

00282 {
00283   return ACE_Select_Reactor::register_handler_i (handles,
00284                                                  handler,
00285                                                  mask);
00286 }

int ACE_XtReactor::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 198 of file XtReactor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_ASSERT, ACE_BIT_ENABLED, ACE_NEW_RETURN, ACE_Reactor_Mask, ACE_SET_BITS, ACE_TRACE, ACE_Event_Handler::CONNECT_MASK, context_, ACE_Event_Handler::EXCEPT_MASK, ACE_XtReactorID::handle_, ACE_XtReactorID::id_, ids_, InputCallbackProc, ACE_XtReactorID::next_, ACE_Event_Handler::READ_MASK, ACE_Select_Reactor_T< ACE_Select_Reactor_Token >::register_handler_i, and ACE_Event_Handler::WRITE_MASK.

00201 {
00202   ACE_TRACE ("ACE_XtReactor::register_handler_i");
00203 
00204   // Make sure we have a valid context
00205   ACE_ASSERT (this->context_ != 0);
00206 
00207   int result = ACE_Select_Reactor::register_handler_i (handle,
00208                                                        handler, mask);
00209   if (result == -1)
00210     return -1;
00211 
00212   int condition = 0;
00213 
00214 #if !defined ACE_WIN32
00215   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK))
00216     ACE_SET_BITS (condition, XtInputReadMask);
00217   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK))
00218     ACE_SET_BITS (condition, XtInputWriteMask);
00219   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
00220     ACE_SET_BITS (condition, XtInputExceptMask);
00221   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
00222     ACE_SET_BITS (condition, XtInputReadMask);
00223   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){
00224       ACE_SET_BITS (condition, XtInputWriteMask); // connected, you may write
00225       ACE_SET_BITS (condition, XtInputReadMask);  // connected, you have data/err
00226   }
00227 #else
00228   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK))
00229     ACE_SET_BITS (condition, XtInputReadWinsock);
00230   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK))
00231     ACE_SET_BITS (condition, XtInputWriteWinsock);
00232   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
00233     ACE_NOTSUP_RETURN(-1);
00234   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
00235     ACE_SET_BITS (condition, XtInputReadWinsock);
00236   if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){
00237       ACE_SET_BITS (condition, XtInputWriteWinsock); // connected, you may write
00238       ACE_SET_BITS (condition, XtInputReadWinsock);  // connected, you have data/err
00239   }
00240 #endif /* !ACE_WIN32 */
00241 
00242   if (condition != 0)
00243     {
00244       ACE_XtReactorID *XtID = this->ids_;
00245 
00246       while(XtID)
00247         {
00248           if (XtID->handle_ == handle)
00249             {
00250               ::XtRemoveInput (XtID->id_);
00251 
00252               XtID->id_ = ::XtAppAddInput (this->context_,
00253                                            (int) handle,
00254                                            (XtPointer) condition,
00255                                            InputCallbackProc,
00256                                            (XtPointer) this);
00257               return 0;
00258             }
00259           else
00260             XtID = XtID->next_;
00261         }
00262 
00263       ACE_NEW_RETURN (XtID,
00264                       ACE_XtReactorID,
00265                       -1);
00266       XtID->next_ = this->ids_;
00267       XtID->handle_ = handle;
00268       XtID->id_ = ::XtAppAddInput (this->context_,
00269                                   (int) handle,
00270                                   (XtPointer) condition,
00271                                   InputCallbackProc,
00272                                   (XtPointer) this);
00273       this->ids_ = XtID;
00274     }
00275   return 0;
00276 }

int ACE_XtReactor::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 344 of file XtReactor.cpp.

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

00346 {
00347   return ACE_Select_Reactor::remove_handler_i (handles,
00348                                                mask);
00349 }

int ACE_XtReactor::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 289 of file XtReactor.cpp.

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

00291 {
00292   ACE_TRACE ("ACE_XtReactor::remove_handler_i");
00293 
00294   // In the registration phase we registered first with
00295   // ACE_Select_Reactor and then with X.  Now we are now doing things
00296   // in reverse order.
00297 
00298   // First clean up the corresponding X11Input.
00299   this->remove_XtInput (handle);
00300 
00301   // Now let the reactor do its work.
00302   return ACE_Select_Reactor::remove_handler_i (handle,
00303                                                mask);
00304 }

void ACE_XtReactor::remove_XtInput ACE_HANDLE    handle [protected, virtual]
 

Removes an Xt handle.

Definition at line 307 of file XtReactor.cpp.

References ACE_TRACE, ACE_XtReactorID::handle_, ACE_XtReactorID::id_, ids_, and ACE_XtReactorID::next_.

Referenced by remove_handler_i.

00308 {
00309   ACE_TRACE ("ACE_XtReactor::remove_XtInput");
00310 
00311   ACE_XtReactorID *XtID = this->ids_;
00312 
00313   if (XtID)
00314     {
00315       if (XtID->handle_ == handle)
00316         {
00317           ::XtRemoveInput (XtID->id_);
00318           this->ids_ = XtID->next_;
00319           delete XtID;
00320           return;
00321         }
00322 
00323       ACE_XtReactorID *NextID = XtID->next_;
00324 
00325       while (NextID)
00326         {
00327           if (NextID->handle_ == handle)
00328             {
00329               ::XtRemoveInput(NextID->id_);
00330               XtID->next_ = NextID->next_;
00331               delete NextID;
00332               return;
00333             }
00334           else
00335             {
00336               XtID = NextID;
00337               NextID = NextID->next_;
00338             }
00339         }
00340     }
00341 }

void ACE_XtReactor::reset_timeout void    [private]
 

This method ensures there's an Xt timeout for the first timeout in the Reactor's Timer_Queue.

Definition at line 355 of file XtReactor.cpp.

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

Referenced by cancel_timer, schedule_timer, and TimerCallbackProc.

00356 {
00357   // Make sure we have a valid context
00358   ACE_ASSERT (this->context_ != 0);
00359 
00360   if (timeout_)
00361     ::XtRemoveTimeOut (timeout_);
00362   timeout_ = 0;
00363 
00364   ACE_Time_Value *max_wait_time =
00365     this->timer_queue_->calculate_timeout (0);
00366 
00367   if (max_wait_time)
00368     timeout_ = ::XtAppAddTimeOut (this->context_,
00369                                   max_wait_time->msec (),
00370                                   TimerCallbackProc,
00371                                   (XtPointer) this);
00372 }

int ACE_XtReactor::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 376 of file XtReactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, and ACE_TRACE.

00378 {
00379   ACE_TRACE ("ACE_XtReactor::reset_timer_interval");
00380   ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
00381 
00382   int result = ACE_Select_Reactor::timer_queue_->reset_interval
00383     (timer_id,
00384      interval);
00385 
00386   if (result == -1)
00387     return -1;
00388   else
00389     {
00390       this->reset_timeout ();
00391       return result;
00392     }
00393 }

long ACE_XtReactor::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 396 of file XtReactor.cpp.

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

00400 {
00401   ACE_TRACE ("ACE_XtReactor::schedule_timer");
00402   ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
00403 
00404   long result = ACE_Select_Reactor::schedule_timer (event_handler,
00405                                                     arg,
00406                                                     delay,
00407                                                     interval);
00408   if (result == -1)
00409     return -1;
00410   else
00411     {
00412       this->reset_timeout ();
00413       return result;
00414     }
00415 }

void ACE_XtReactor::TimerCallbackProc XtPointer    closure,
XtIntervalId *    id
[static, private]
 

Definition at line 90 of file XtReactor.cpp.

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

Referenced by reset_timeout.

00091 {
00092   ACE_XtReactor *self = (ACE_XtReactor *) closure;
00093   self->timeout_ = 0;
00094 
00095   // Deal with any timer events
00096   ACE_Select_Reactor_Handle_Set handle_set;
00097   self->dispatch (0, handle_set);
00098   self->reset_timeout ();
00099 }

int ACE_XtReactor::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 58 of file XtReactor.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_, ACE_Select_Reactor_Impl::wait_set_, ACE_Select_Reactor_Handle_Set::wr_mask_, and XtWaitForMultipleEvents.

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

int ACE_XtReactor::XtWaitForMultipleEvents int   ,
ACE_Select_Reactor_Handle_Set  ,
ACE_Time_Value  
[protected, virtual]
 

Wait for Xt events to occur.

Definition at line 150 of file XtReactor.cpp.

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


Member Data Documentation

XtAppContext ACE_XtReactor::context_ [protected]
 

Definition at line 118 of file XtReactor.h.

Referenced by context, register_handler_i, reset_timeout, and XtWaitForMultipleEvents.

ACE_XtReactorID* ACE_XtReactor::ids_ [protected]
 

Definition at line 119 of file XtReactor.h.

Referenced by register_handler_i, remove_XtInput, and ~ACE_XtReactor.

XtIntervalId ACE_XtReactor::timeout_ [protected]
 

Definition at line 120 of file XtReactor.h.

Referenced by reset_timeout, and TimerCallbackProc.


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