An object-oriented event demultiplexor and event handler dispatcher that uses the Qt Library. This class declaration also uses the extension facilities provided by the Qt. So, readers of the class declaration should not be upset with the appearence of the Keywords like Q_OBJECT, private slots etc. They are specific to Qt which uses these as a call back methods implementation mechanism. More...
#include <QtReactor.h>
Public Member Functions | |
ACE_QtReactor (QApplication *qapp=0, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *notify=0, bool mask_signals=true, int s_queue=ACE_SELECT_TOKEN::FIFO) | |
Constructor follows . | |
ACE_QtReactor (size_t size, QApplication *qapp=0, bool restart=false, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *notify=0, bool mask_signals=true, int s_queue=ACE_SELECT_TOKEN::FIFO) | |
Constructor follows . | |
virtual | ~ACE_QtReactor (void) |
void | qapplication (QApplication *qapp) |
virtual long | schedule_timer (ACE_Event_Handler *handler, const void *arg, const ACE_Time_Value &delay_time, const ACE_Time_Value &interval) |
virtual int | cancel_timer (ACE_Event_Handler *handler, int dont_call_handle_close=1) |
virtual int | cancel_timer (long timer_id, const void **arg=0, int dont_call_handle_close=1) |
Protected Types | |
typedef ACE_Map_Manager < ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex > | MAP |
Typedef of a map. | |
Protected Member Functions | |
virtual int | register_handler_i (ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask) |
Register a single handler. | |
virtual int | register_handler_i (const ACE_Handle_Set &handles, ACE_Event_Handler *handler, ACE_Reactor_Mask mask) |
Register a set of <handlers> with Qt. | |
virtual int | remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
Remove the <handler> associated with this handle. | |
virtual int | remove_handler_i (const ACE_Handle_Set &handles, ACE_Reactor_Mask mask) |
Remove a set of <handles>. | |
virtual int | wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, ACE_Time_Value *max_wait_time) |
Wait for events to occur. | |
virtual int | QtWaitForMultipleEvents (int width, ACE_Select_Reactor_Handle_Set &wait_set, ACE_Time_Value *max_wait_time) |
virtual int | bit_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Select_Reactor_Handle_Set &handle_set, int ops) |
Allow manipulation of the <wait_set_> mask and <ready_set_> mask. | |
int | set_enable_flag_by_mask (int flag_value, ACE_HANDLE handle, ACE_Reactor_Mask mask) |
void | create_notifiers_for_handle (ACE_HANDLE handle) |
void | destroy_notifiers_for_handle (ACE_HANDLE handle) |
Protected Attributes | |
QApplication * | qapp_ |
Some Qt stuff that we need to have. | |
MAP | read_notifier_ |
A notifier for a read. | |
MAP | write_notifier_ |
A write notifier. | |
MAP | exception_notifier_ |
An exception notifier. | |
QTimer * | qtime_ |
The timer class that would provide timer-sgnals & single-shot timers. | |
Private Slots | |
void | read_event (int FD) |
Dispatch a Read Event. | |
void | write_event (int FD) |
Dispatch a Write Event. | |
void | exception_event (int FD) |
Dispatch an exception event. | |
void | timeout_event (void) |
Dispach a timeout event. | |
Private Member Functions | |
void | reset_timeout (void) |
void | reopen_notification_pipe (void) |
reopens notification pipe to create SocketNotifier for it | |
ACE_QtReactor (const ACE_QtReactor &) | |
Deny access since member-wise won't work... | |
ACE_QtReactor & | operator= (const ACE_QtReactor &) |
An object-oriented event demultiplexor and event handler dispatcher that uses the Qt Library. This class declaration also uses the extension facilities provided by the Qt. So, readers of the class declaration should not be upset with the appearence of the Keywords like Q_OBJECT, private slots etc. They are specific to Qt which uses these as a call back methods implementation mechanism.
Definition at line 97 of file QtReactor.h.
typedef ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> ACE_QtReactor::MAP [protected] |
Typedef of a map.
Definition at line 192 of file QtReactor.h.
ACE_QtReactor::ACE_QtReactor | ( | QApplication * | qapp = 0 , |
|
ACE_Sig_Handler * | sh = 0 , |
|||
ACE_Timer_Queue * | tq = 0 , |
|||
int | disable_notify_pipe = 0 , |
|||
ACE_Reactor_Notify * | notify = 0 , |
|||
bool | mask_signals = true , |
|||
int | s_queue = ACE_SELECT_TOKEN::FIFO | |||
) |
Constructor follows .
QApplication | *qapp, qapplication which runs events loop |
Definition at line 11 of file QtReactor.cpp.
: ACE_Select_Reactor( sh, tq, disable_notify_pipe, notify, mask_signals, s_queue), qapp_(qapp), qtime_ (0) { reopen_notification_pipe(); }
ACE_QtReactor::ACE_QtReactor | ( | size_t | size, | |
QApplication * | qapp = 0 , |
|||
bool | restart = false , |
|||
ACE_Sig_Handler * | sh = 0 , |
|||
ACE_Timer_Queue * | tq = 0 , |
|||
int | disable_notify_pipe = 0 , |
|||
ACE_Reactor_Notify * | notify = 0 , |
|||
bool | mask_signals = true , |
|||
int | s_queue = ACE_SELECT_TOKEN::FIFO | |||
) |
Constructor follows .
QApplication | *qapp, qapplication which runs events loop |
Definition at line 27 of file QtReactor.cpp.
: ACE_Select_Reactor( size, restart, sh, tq, disable_notify_pipe, notify, mask_signals, s_queue ), qapp_(qapp), qtime_ (0) { reopen_notification_pipe(); }
ACE_QtReactor::~ACE_QtReactor | ( | void | ) | [virtual] |
Definition at line 73 of file QtReactor.cpp.
{ // iterate over QSocketNotifiers for read and release them MAP::ITERATOR iter = this->read_notifier_.begin (); MAP::ITERATOR iterEnd = this->read_notifier_.end (); while( iter != iterEnd ) { MAP::ENTRY &entry = *iter; // QOBject destructor notifies qapplication (hopefully) on delete delete entry.int_id_; ++iter; } // iterate over QSocketNotifiers for write and release them this->write_notifier_.begin (); this->write_notifier_.end (); while( iter != iterEnd ) { MAP::ENTRY &entry = *iter; // QOBject destructor notifies qapplication (hopefully) on delete delete entry.int_id_; ++iter; } // iterate over QSocketNotifiers for exceptions and release them this->exception_notifier_.begin (); this->exception_notifier_.end (); while( iter != iterEnd ) { MAP::ENTRY &entry = *iter; // QOBject destructor notifies qapplication (hopefully) on delete delete entry.int_id_; ++iter; } // QOBject destructor notifies qapplication (hopefully) on delete delete qtime_; }
ACE_QtReactor::ACE_QtReactor | ( | const ACE_QtReactor & | ) | [private] |
Deny access since member-wise won't work...
int ACE_QtReactor::bit_ops | ( | ACE_HANDLE | handle, | |
ACE_Reactor_Mask | mask, | |||
ACE_Select_Reactor_Handle_Set & | handle_set, | |||
int | ops | |||
) | [protected, virtual] |
Allow manipulation of the <wait_set_> mask and <ready_set_> mask.
Reimplemented from ACE_Select_Reactor_Impl.
Definition at line 262 of file QtReactor.cpp.
{ int result; ACE_Select_Reactor_Handle_Set preserved_handle_set = handle_set; // Call regular bit_ops if ((result = ACE_Select_Reactor::bit_ops (handle, mask, handle_set, ops)) == -1) return -1; // disable or enable the notifiers based on handle_set and mask int enableFlag = -1; if (&handle_set == &this->suspend_set_) enableFlag = 0; else if (&handle_set == &this->wait_set_) enableFlag = 1; else // We have no work to do here, so just return return result; switch (ops) { case ACE_Reactor::SET_MASK: case ACE_Reactor::ADD_MASK: // Enable or disable notifiers based on the specified masks if (this->set_enable_flag_by_mask (enableFlag, handle, mask) == -1) { // We can't just return -1 here because we'll have half-changed things. // So, we need to restore the old handle_set, then return -1. handle_set = preserved_handle_set; return -1; } break; case ACE_Reactor::CLR_MASK: if (this->set_enable_flag_by_mask (!enableFlag, handle, mask) == -1) { handle_set = preserved_handle_set; return -1; } break; default: // we take no action for any other operations break; } return result; }
int ACE_QtReactor::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.
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 535 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (handler, dont_call_handle_close ) == -1 ) return -1 ; else { this->reset_timeout( ) ; return 0 ; } }
int ACE_QtReactor::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.
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 550 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::cancel_timer") ; if (ACE_Select_Reactor::cancel_timer (timer_id, arg, dont_call_handle_close ) == -1 ) return -1 ; else { this->reset_timeout( ) ; return 0 ; } }
void ACE_QtReactor::create_notifiers_for_handle | ( | ACE_HANDLE | handle | ) | [protected] |
Definition at line 315 of file QtReactor.cpp.
{ QSocketNotifier *qsock_notifier = 0; // if there is already a read socket notifier for this handle, do nothing // otherwise create read notifier if ( ( this->read_notifier_.find (handle, qsock_notifier) == -1) ) { ACE_NEW (qsock_notifier, QSocketNotifier (int(handle), QSocketNotifier::Read, this)); this->read_notifier_.bind (handle, qsock_notifier); QObject::connect (qsock_notifier, SIGNAL (activated (int)), this, SLOT (read_event (int))) ; // disable; it will be enabled by the regular register_handler_i if // necessary qsock_notifier->setEnabled (0); } qsock_notifier = 0; // if there is already a write socket notifier for this handle, do nothing // otherwise create read notifier if ((this->write_notifier_.find (handle, qsock_notifier) == -1)) { ACE_NEW (qsock_notifier, QSocketNotifier (int(handle), QSocketNotifier::Write, this)); this->write_notifier_.bind (handle, qsock_notifier); QObject::connect (qsock_notifier, SIGNAL (activated (int)), this, SLOT (write_event (int))); // disable; it will be enabled by the regular register_handler_i if // necessary qsock_notifier->setEnabled (0); } qsock_notifier = 0; // if there is already a write socket notifier for this handle, do nothing // otherwise create read notifier if ((this->exception_notifier_.find (handle, qsock_notifier) == -1)) { ACE_NEW (qsock_notifier, QSocketNotifier (int(handle), QSocketNotifier::Exception, this)); this->exception_notifier_.bind (handle, qsock_notifier); QObject::connect (qsock_notifier, SIGNAL (activated (int)), this, SLOT (exception_event (int))) ; // disable; it will be enabled by the regular register_handler_i if // necessary qsock_notifier->setEnabled (0); } }
void ACE_QtReactor::destroy_notifiers_for_handle | ( | ACE_HANDLE | handle | ) | [protected] |
Definition at line 386 of file QtReactor.cpp.
{ QSocketNotifier *qsock_notifier = 0; // Looks for the handle in the maps and removes them. if ((this->read_notifier_.find (handle, qsock_notifier) != -1)) { this->read_notifier_.unbind (handle, qsock_notifier); delete qsock_notifier; } if ((this->write_notifier_.find (handle, qsock_notifier) != -1)) { this->write_notifier_.unbind (handle, qsock_notifier); delete qsock_notifier; } if ((this->exception_notifier_.find (handle, qsock_notifier) != -1)) { this->exception_notifier_.unbind (handle, qsock_notifier); delete qsock_notifier; } }
void ACE_QtReactor::exception_event | ( | int | FD | ) | [private, slot] |
Dispatch an exception event.
Definition at line 190 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::exception_event"); ACE_HANDLE handle = ACE_HANDLE( p_handle ); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // disable socket notifier to clear pending events QSocketNotifier *qsock_notifier = 0; if ( ( this->exception_notifier_.find( handle, qsock_notifier) != -1) ) qsock_notifier->setEnabled( false ); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ // The core of exception event handling ACE_Select_Reactor_Handle_Set dispatch_set; dispatch_set.ex_mask_.set_bit( handle ); dispatch (1, dispatch_set); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // enable socket notifier according to current mask ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ }
ACE_QtReactor& ACE_QtReactor::operator= | ( | const ACE_QtReactor & | ) | [private] |
void ACE_QtReactor::qapplication | ( | QApplication * | qapp | ) |
Definition at line 113 of file QtReactor.cpp.
{ // reparent QSocketNotifiers and QTimer qapp_ = qapp ; }
int ACE_QtReactor::QtWaitForMultipleEvents | ( | int | width, | |
ACE_Select_Reactor_Handle_Set & | wait_set, | |||
ACE_Time_Value * | max_wait_time | |||
) | [protected, virtual] |
Definition at line 569 of file QtReactor.cpp.
{ // Keep a copy of the wait set in case the wait_set be changed // between the two select calls in this function. It could happen // while waiting for an event, another event is handled and dispatched // which changes the dispatch_set_/wait_set. ACE_Select_Reactor_Handle_Set orig_wait_set = wait_set; // Check to make sure our handle's are all usable. ACE_Select_Reactor_Handle_Set temp_set = wait_set; if (ACE_OS::select (width, temp_set.rd_mask_, temp_set.wr_mask_, temp_set.ex_mask_, (ACE_Time_Value *) &ACE_Time_Value::zero ) == -1) return -1; // Bad file arguments... // Qt processing. #if QT_VERSION >= 0x040000 this->qapp_->processEvents(); #else this->qapp_->processOneEvent (); #endif // Reset the width, in case it changed during the upcalls. width = handler_rep_.max_handlep1 (); // Now actually read the result needed by the <Select_Reactor> using // <select>. return ACE_OS::select(width, orig_wait_set.rd_mask_, orig_wait_set.wr_mask_, orig_wait_set.ex_mask_, (ACE_Time_Value *) &ACE_Time_Value::zero); }
void ACE_QtReactor::read_event | ( | int | FD | ) | [private, slot] |
Dispatch a Read Event.
Definition at line 131 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::read_event"); ACE_HANDLE handle = ACE_HANDLE( p_handle ); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // disable socket notifier to clear pending events QSocketNotifier *qsock_notifier = 0; if ( ( this->read_notifier_.find( handle, qsock_notifier) != -1) ) qsock_notifier->setEnabled( false ); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ // The core of read event handling ACE_Select_Reactor_Handle_Set dispatch_set; dispatch_set.rd_mask_.set_bit ( handle ); this->dispatch (1, dispatch_set); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // enable socket notifier according to current mask ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ }
int ACE_QtReactor::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 419 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::register_handler_i"); this->create_notifiers_for_handle (handle); int result; if ((result = ACE_Select_Reactor::register_handler_i(handle, handler, mask )) == -1) { // destroy notifiers only when there is no handler for handle if ( !ACE_Select_Reactor::find_handler( handle ) ) this->destroy_notifiers_for_handle (handle); return -1; } return 0; }
int ACE_QtReactor::register_handler_i | ( | const ACE_Handle_Set & | handles, | |
ACE_Event_Handler * | handler, | |||
ACE_Reactor_Mask | mask | |||
) | [protected, virtual] |
Register a set of <handlers> with Qt.
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 443 of file QtReactor.cpp.
{ return ACE_Select_Reactor::register_handler_i(handles, handler, mask); }
int ACE_QtReactor::remove_handler_i | ( | const ACE_Handle_Set & | handles, | |
ACE_Reactor_Mask | mask | |||
) | [protected, virtual] |
Remove a set of <handles>.
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 466 of file QtReactor.cpp.
{ return ACE_Select_Reactor::remove_handler_i (handles, mask); }
int ACE_QtReactor::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 452 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::remove_handler_i"); int result = ACE_Select_Reactor::remove_handler_i (handle, mask); // destroy notifiers only when there is no handler for handle if ( !ACE_Select_Reactor::find_handler( handle ) ) this->destroy_notifiers_for_handle (handle); return result; }
void ACE_QtReactor::reopen_notification_pipe | ( | void | ) | [private] |
reopens notification pipe to create SocketNotifier for it
Definition at line 46 of file QtReactor.cpp.
{ // When the ACE_Select_Reactor is constructed it creates the notify // pipe and registers it with the register_handler_i() method. The // QtReactor overloads this method BUT because the // register_handler_i occurs when constructing the base class // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() // is called not the QtReactor register_handler_i(). This means // that the notify pipe is registered with the ACE_Select_Reactor // event handling code not the QtReactor and so notfications don't // work. To get around this we simply close and re-opened the // notification handler in the constructor of the QtReactor. #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) if ( initialized_ ) { this->notify_handler_->close (); // Patch for MS Windows: close and open doesn't clear the read // fd_set, so reset it manually this->wait_set_.rd_mask_.reset (); this->notify_handler_->open (this, 0); } #endif /* ACE_MT_SAFE */ }
void ACE_QtReactor::reset_timeout | ( | void | ) | [private] |
This method ensures there's an Qt timeout for the first timeout in the Reactor's Timer_Queue.
Definition at line 477 of file QtReactor.cpp.
{ if (this->qtime_ != 0) { delete this->qtime_; this->qtime_ = 0; } ACE_Time_Value *max_wait_time = this->timer_queue_->calculate_timeout (0) ; if (max_wait_time) { ACE_NEW (this->qtime_, QTimer); QObject::connect (qtime_, SIGNAL (timeout ()), this, SLOT (timeout_event ())); #if QT_VERSION >= 0x040000 qtime_->setSingleShot (1); qtime_->start(max_wait_time->msec()); #else qtime_->start(max_wait_time->msec(), 1); #endif } }
long ACE_QtReactor::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.
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 |
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 510 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::schedule_timer"); ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); long result; if ((result = ACE_Select_Reactor::schedule_timer(handler, arg, delay_time, interval)) == -1 ) return -1; else { this->reset_timeout (); return result; } }
int ACE_QtReactor::set_enable_flag_by_mask | ( | int | flag_value, | |
ACE_HANDLE | handle, | |||
ACE_Reactor_Mask | mask | |||
) | [protected] |
Definition at line 220 of file QtReactor.cpp.
{ QSocketNotifier *qs_not; if (ACE_BIT_ENABLED(mask, ACE_Event_Handler::READ_MASK) || ACE_BIT_ENABLED( mask, ACE_Event_Handler::ACCEPT_MASK)) { // Find the current notifier qs_not = 0; if ((this->read_notifier_.find (handle, qs_not) == -1)) return -1; qs_not->setEnabled (flag_value); } if (ACE_BIT_ENABLED( mask, ACE_Event_Handler::WRITE_MASK) || ACE_BIT_ENABLED( mask, ACE_Event_Handler::ACCEPT_MASK) || ACE_BIT_ENABLED( mask, ACE_Event_Handler::CONNECT_MASK)) { qs_not = 0; if ((this->write_notifier_.find (handle, qs_not) == -1)) return -1; qs_not->setEnabled (flag_value); } if (ACE_BIT_ENABLED( mask, ACE_Event_Handler::EXCEPT_MASK)) { qs_not = 0; if ((this->exception_notifier_.find (handle, qs_not) == -1)) return -1; qs_not->setEnabled (flag_value); } return 0; }
void ACE_QtReactor::timeout_event | ( | void | ) | [private, slot] |
Dispach a timeout event.
Definition at line 120 of file QtReactor.cpp.
{ // Deal with any timer events ACE_Select_Reactor_Handle_Set handle_set; this->dispatch (0, handle_set ); // Set next timeout signal this->reset_timeout (); }
int ACE_QtReactor::wait_for_multiple_events | ( | ACE_Select_Reactor_Handle_Set & | handle_set, | |
ACE_Time_Value * | max_wait_time | |||
) | [protected, virtual] |
Wait for events to occur.
Reimplemented from ACE_Select_Reactor_T< ACE_Select_Reactor_Token >.
Definition at line 610 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::wait_for_multiple_events"); int nfound = 0; do { max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); size_t width = this->handler_rep_.max_handlep1 (); handle_set.rd_mask_ = this->wait_set_.rd_mask_; handle_set.wr_mask_ = this->wait_set_.wr_mask_; handle_set.ex_mask_ = this->wait_set_.ex_mask_; nfound = QtWaitForMultipleEvents (width, handle_set, max_wait_time); } while( nfound == -1 && this->handle_error () > 0 ); if (nfound > 0) { #if !defined (ACE_WIN32) handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); #endif /* ACE_WIN32 */ } return nfound; // Timed out or input available }
void ACE_QtReactor::write_event | ( | int | FD | ) | [private, slot] |
Dispatch a Write Event.
Definition at line 161 of file QtReactor.cpp.
{ ACE_TRACE ("ACE_QtReactor::write_event"); ACE_HANDLE handle = ACE_HANDLE( p_handle ); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // disable socket notifier to clear pending events QSocketNotifier *qsock_notifier = 0; if ( ( this->write_notifier_.find( handle, qsock_notifier) != -1) ) qsock_notifier->setEnabled( false ); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ // The core of write event handling ACE_Select_Reactor_Handle_Set dispatch_set; dispatch_set.wr_mask_.set_bit( handle ); this->dispatch (1, dispatch_set); #ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS // enable socket notifier according to current mask ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ }
MAP ACE_QtReactor::exception_notifier_ [protected] |
An exception notifier.
Definition at line 201 of file QtReactor.h.
QApplication* ACE_QtReactor::qapp_ [protected] |
Some Qt stuff that we need to have.
Definition at line 189 of file QtReactor.h.
QTimer* ACE_QtReactor::qtime_ [protected] |
The timer class that would provide timer-sgnals & single-shot timers.
Definition at line 204 of file QtReactor.h.
MAP ACE_QtReactor::read_notifier_ [protected] |
A notifier for a read.
Definition at line 195 of file QtReactor.h.
MAP ACE_QtReactor::write_notifier_ [protected] |
A write notifier.
Definition at line 198 of file QtReactor.h.