#include <Select_Reactor_Base.h>
Inheritance diagram for ACE_Select_Reactor_Impl:
Public Types | |
enum | { DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE } |
Public Member Functions | |
ACE_Select_Reactor_Impl (bool mask_signals=true) | |
Constructor. | |
virtual int | purge_pending_notifications (ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
virtual int | resumable_handler (void) |
Protected Member Functions | |
virtual int | bit_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Select_Reactor_Handle_Set &handle_set, int ops) |
Allow manipulation of the mask and mask. | |
virtual void | renew (void)=0 |
virtual int | is_suspended_i (ACE_HANDLE handle)=0 |
virtual void | clear_dispatch_mask (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
int | supress_notify_renew (void) |
void | supress_notify_renew (int sr) |
Protected Attributes | |
ACE_Select_Reactor_Handler_Repository | handler_rep_ |
Table that maps to <ACE_Event_Handler *>'s. | |
ACE_Select_Reactor_Handle_Set | dispatch_set_ |
Tracks handles that are ready for dispatch from . | |
ACE_Select_Reactor_Handle_Set | wait_set_ |
Tracks handles that are waited for by . | |
ACE_Select_Reactor_Handle_Set | suspend_set_ |
Tracks handles that are currently suspended. | |
ACE_Select_Reactor_Handle_Set | ready_set_ |
ACE_Timer_Queue * | timer_queue_ |
Defined as a pointer to allow overriding by derived classes... | |
ACE_Sig_Handler * | signal_handler_ |
Handle signals without requiring global/static variables. | |
ACE_Reactor_Notify * | notify_handler_ |
bool | delete_timer_queue_ |
bool | delete_signal_handler_ |
bool | delete_notify_handler_ |
bool | initialized_ |
True if we've been initialized yet... | |
int | restart_ |
int | requeue_position_ |
ACE_thread_t | owner_ |
The original thread that created this Select_Reactor. | |
bool | state_changed_ |
bool | mask_signals_ |
Private Member Functions | |
ACE_Select_Reactor_Impl (const ACE_Select_Reactor_Impl &) | |
Deny access since member-wise won't work... | |
ACE_Select_Reactor_Impl & | operator= (const ACE_Select_Reactor_Impl &) |
Private Attributes | |
int | supress_renew_ |
Friends | |
class | ACE_Select_Reactor_Notify |
class | ACE_Select_Reactor_Handler_Repository |
Definition at line 427 of file Select_Reactor_Base.h.
|
Definition at line 430 of file Select_Reactor_Base.h.
00431 { 00432 /// Default size of the Select_Reactor's handle table. 00433 DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE 00434 }; |
|
Constructor.
Definition at line 58 of file Select_Reactor_Base.inl.
00059 : handler_rep_ (*this) 00060 , timer_queue_ (0) 00061 , signal_handler_ (0) 00062 , notify_handler_ (0) 00063 , delete_timer_queue_ (false) 00064 , delete_signal_handler_ (false) 00065 , delete_notify_handler_ (false) 00066 , initialized_ (false) 00067 , restart_ (0) 00068 , requeue_position_ (-1) // Requeue at end of waiters by default. 00069 , state_changed_ (0) 00070 , mask_signals_ (ms) 00071 , supress_renew_ (0) 00072 { 00073 } |
|
Deny access since member-wise won't work...
|
|
Allow manipulation of the mask and mask.
Reimplemented in ACE_QtReactor. Definition at line 1113 of file Select_Reactor_Base.cpp. References ACE_BIT_ENABLED, ACE_FDS_PTMF, ACE_Reactor_Mask, ACE_SET_BITS, ACE_TRACE, clear_dispatch_mask(), ACE_Handle_Set::clr_bit(), ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::handle_in_range(), ACE_Handle_Set::is_set(), ACE_Select_Reactor_Handle_Set::rd_mask_, and ACE_Select_Reactor_Handle_Set::wr_mask_. Referenced by ACE_Select_Reactor_Handler_Repository::bind(), ACE_QtReactor::bit_ops(), and ACE_Select_Reactor_Handler_Repository::unbind().
01117 { 01118 ACE_TRACE ("ACE_Select_Reactor_Impl::bit_ops"); 01119 if (this->handler_rep_.handle_in_range (handle) == 0) 01120 return -1; 01121 01122 #if !defined (ACE_WIN32) 01123 ACE_Sig_Guard sb (0, 01124 this->mask_signals_); // Block out all signals until method returns. 01125 #endif /* ACE_WIN32 */ 01126 01127 ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit; 01128 u_long omask = ACE_Event_Handler::NULL_MASK; 01129 01130 // Find the old reactor masks. This automatically does the work of 01131 // the GET_MASK operation. 01132 if (handle_set.rd_mask_.is_set (handle)) 01133 ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK); 01134 if (handle_set.wr_mask_.is_set (handle)) 01135 ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK); 01136 if (handle_set.ex_mask_.is_set (handle)) 01137 ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK); 01138 01139 switch (ops) 01140 { 01141 case ACE_Reactor::GET_MASK: 01142 // The work for this operation is done in all cases at the 01143 // begining of the function. 01144 break; 01145 case ACE_Reactor::CLR_MASK: 01146 ptmf = &ACE_Handle_Set::clr_bit; 01147 // State was changed. we need to reflect that change in the 01148 // dispatch_mask I assume that only ACE_Reactor::CLR_MASK should 01149 // be treated here which means we need to clear the handle|mask 01150 // from the current dispatch handler 01151 this->clear_dispatch_mask (handle, mask); 01152 /* FALLTHRU */ 01153 case ACE_Reactor::SET_MASK: 01154 /* FALLTHRU */ 01155 case ACE_Reactor::ADD_MASK: 01156 01157 // The following code is rather subtle... Note that if we are 01158 // doing a ACE_Reactor::SET_MASK then if the bit is not enabled 01159 // in the mask we need to clear the bit from the ACE_Handle_Set. 01160 // On the other hand, if we are doing a ACE_Reactor::CLR_MASK or 01161 // a ACE_Reactor::ADD_MASK we just carry out the operations 01162 // specified by the mask. 01163 01164 // READ, ACCEPT, and CONNECT flag will place the handle in the 01165 // read set. 01166 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) 01167 || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK) 01168 || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) 01169 { 01170 (handle_set.rd_mask_.*ptmf) (handle); 01171 } 01172 else if (ops == ACE_Reactor::SET_MASK) 01173 handle_set.rd_mask_.clr_bit (handle); 01174 01175 // WRITE and CONNECT flag will place the handle in the write set 01176 if (ACE_BIT_ENABLED (mask, 01177 ACE_Event_Handler::WRITE_MASK) 01178 || ACE_BIT_ENABLED (mask, 01179 ACE_Event_Handler::CONNECT_MASK)) 01180 { 01181 (handle_set.wr_mask_.*ptmf) (handle); 01182 } 01183 else if (ops == ACE_Reactor::SET_MASK) 01184 handle_set.wr_mask_.clr_bit (handle); 01185 01186 // EXCEPT (and CONNECT on Win32) flag will place the handle in 01187 // the except set. 01188 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK) 01189 #if defined (ACE_WIN32) 01190 || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK) 01191 #endif /* ACE_WIN32 */ 01192 ) 01193 { 01194 (handle_set.ex_mask_.*ptmf) (handle); 01195 } 01196 else if (ops == ACE_Reactor::SET_MASK) 01197 handle_set.ex_mask_.clr_bit (handle); 01198 break; 01199 default: 01200 return -1; 01201 } 01202 return omask; 01203 } |
|
When register/unregister occur, then we need to re-eval our wait/suspend/dispatch set. Reimplemented in ACE_TP_Reactor. Definition at line 1206 of file Select_Reactor_Base.cpp. References ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_TRACE, ACE_Handle_Set::clr_bit(), dispatch_set_, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handle_Set::rd_mask_, state_changed_, and ACE_Select_Reactor_Handle_Set::wr_mask_. Referenced by bit_ops(), ACE_Priority_Reactor::dispatch_io_set(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_i().
01208 { 01209 ACE_TRACE ("ACE_Select_Reactor_Impl::clear_dispatch_mask"); 01210 01211 // Use handle and mask in order to modify the sets 01212 // (wait/suspend/ready/dispatch), that way, the dispatch_io_set loop 01213 // will not be interrupt, and there will no reason to rescan the 01214 // wait_set and re-calling select function, which is *very* 01215 // expensive. It seems that wait/suspend/ready sets are getting 01216 // updated in register/remove bind/unbind etc functions. The only 01217 // thing need to be updated is the dispatch_set (also can be found 01218 // in that file code as dispatch_mask). Because of that, we need 01219 // that dispatch_set to be member of the ACE_Select_Reactor_impl in 01220 // Select_Reactor_Base.h file That way we will have access to that 01221 // member in that function. 01222 01223 // We kind of invalidate the iterator in dispatch_io_set because its 01224 // an array and index built from the original dispatch-set. Take a 01225 // look at dispatch_io_set for more details. 01226 01227 // We only need to clr_bit, because we are interested in clearing the 01228 // handles that was removed, so no dispatching to these handles will 01229 // occur. 01230 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) || 01231 ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) 01232 { 01233 this->dispatch_set_.rd_mask_.clr_bit (handle); 01234 } 01235 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) 01236 { 01237 this->dispatch_set_.wr_mask_.clr_bit (handle); 01238 } 01239 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) 01240 { 01241 this->dispatch_set_.ex_mask_.clr_bit (handle); 01242 } 01243 01244 // That will make the dispatch_io_set iterator re-start and rescan 01245 // the dispatch set. 01246 this->state_changed_ = true; 01247 } |
|
Check to see if the associated with handle is suspended. Returns 0 if not, 1 if so. Implemented in ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >, and ACE_Select_Reactor_T< ACE_Select_Reactor_Token >. Referenced by ACE_Select_Reactor_Handler_Repository::bind(). |
|
|
|
Purge any notifications pending in this reactor for the specified ACE_Event_Handler object. Returns the number of notifications purged. Returns -1 on error. Implements ACE_Reactor_Impl. Definition at line 1092 of file Select_Reactor_Base.cpp. References ACE_Reactor_Mask, and ACE_Reactor_Notify::purge_pending_notifications().
01094 { 01095 if (this->notify_handler_ == 0) 01096 return 0; 01097 else 01098 return this->notify_handler_->purge_pending_notifications (eh, mask); 01099 } |
|
Enqueue ourselves into the list of waiting threads at the appropriate point specified by . Implemented in ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >, and ACE_Select_Reactor_T< ACE_Select_Reactor_Token >. Referenced by ACE_Select_Reactor_Notify::handle_input(). |
|
Does the reactor allow the application to resume the handle on its own ie. can it pass on the control of handle resumption to the application. The select reactor has no handlers that can be resumed by the application. So return 0; Implements ACE_Reactor_Impl. Reimplemented in ACE_TP_Reactor. Definition at line 1251 of file Select_Reactor_Base.cpp.
01252 { 01253 // The select reactor has no handlers that can be resumed by the 01254 // application. So return 0; 01255 01256 return 0; 01257 } |
|
Definition at line 82 of file Select_Reactor_Base.inl. References supress_renew_.
00083 { 00084 this->supress_renew_ = sr; 00085 } |
|
Controls/access whether the notify handler should renew the Select_Reactor's token or not. Definition at line 76 of file Select_Reactor_Base.inl. References supress_renew_. Referenced by ACE_TP_Reactor::ACE_TP_Reactor(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::renew().
00077 { 00078 return this->supress_renew_; 00079 } |
|
Definition at line 440 of file Select_Reactor_Base.h. |
|
Definition at line 439 of file Select_Reactor_Base.h. |
|
Keeps track of whether we need to delete the notify handler (if we didn't create it, then we don't delete it). Definition at line 519 of file Select_Reactor_Base.h. |
|
Keeps track of whether we should delete the signal handler (if we didn't create it, then we don't delete it). Definition at line 515 of file Select_Reactor_Base.h. |
|
Keeps track of whether we should delete the timer queue (if we didn't create it, then we don't delete it). Definition at line 511 of file Select_Reactor_Base.h. |
|
Tracks handles that are ready for dispatch from .
Definition at line 487 of file Select_Reactor_Base.h. Referenced by clear_dispatch_mask(). |
|
Table that maps to <ACE_Event_Handler *>'s.
Definition at line 484 of file Select_Reactor_Base.h. |
|
True if we've been initialized yet...
Definition at line 522 of file Select_Reactor_Base.h. |
|
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 554 of file Select_Reactor_Base.h. |
|
Callback object that unblocks the ACE_Select_Reactor if it's sleeping. Definition at line 507 of file Select_Reactor_Base.h. |
|
The original thread that created this Select_Reactor.
Definition at line 538 of file Select_Reactor_Base.h. |
|
Track HANDLES we are interested in for various events that must be dispatched *without* going through . Definition at line 497 of file Select_Reactor_Base.h. |
|
Position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a callback. If this value == -1 we are requeued at the end of the list. Else if it's 0 then we are requeued at the front of the list. Else if it's > 1 then that indicates the number of waiters to skip over. Definition at line 535 of file Select_Reactor_Base.h. |
|
Restart the event-loop method automatically when is interrupted via . Definition at line 526 of file Select_Reactor_Base.h. |
|
Handle signals without requiring global/static variables.
Definition at line 503 of file Select_Reactor_Base.h. |
|
True if state has changed during dispatching of , else false. This is used to determine whether we need to make another trip through the 's loop. Definition at line 546 of file Select_Reactor_Base.h. Referenced by clear_dispatch_mask(). |
|
Determine whether we should renew Select_Reactor's token after handling the notification message. Definition at line 566 of file Select_Reactor_Base.h. Referenced by supress_notify_renew(). |
|
Tracks handles that are currently suspended.
Definition at line 493 of file Select_Reactor_Base.h. Referenced by ACE_Select_Reactor_Handler_Repository::unbind(). |
|
Defined as a pointer to allow overriding by derived classes...
Definition at line 500 of file Select_Reactor_Base.h. |
|
Tracks handles that are waited for by .
Definition at line 490 of file Select_Reactor_Base.h. Referenced by ACE_FlReactor::fl_io_proc(), ACE_XtReactor::InputCallbackProc(), ACE_TkReactor::InputCallbackProc(), and ACE_Select_Reactor_Handler_Repository::unbind(). |