#include <Select_Reactor_T.h>
Inheritance diagram for ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >:
Public Member Functions | |
ACE_Select_Reactor_T (ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=ACE_DISABLE_NOTIFY_PIPE_DEFAULT, ACE_Reactor_Notify *notify=0, int mask_signals=1, int s_queue=ACE_SELECT_TOKEN::FIFO) | |
ACE_Select_Reactor_T (size_t size, int restart=0, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=ACE_DISABLE_NOTIFY_PIPE_DEFAULT, ACE_Reactor_Notify *notify=0, int mask_signals=1, int s_queue=ACE_SELECT_TOKEN::FIFO) | |
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=ACE_DISABLE_NOTIFY_PIPE_DEFAULT, ACE_Reactor_Notify *=0) |
virtual int | current_info (ACE_HANDLE, size_t &size) |
Returns -1 (not used in this implementation);. | |
virtual int | set_sig_handler (ACE_Sig_Handler *signal_handler) |
Use a user specified signal handler instead. | |
virtual int | timer_queue (ACE_Timer_Queue *tq) |
Set a user-specified timer queue. | |
virtual ACE_Timer_Queue * | timer_queue (void) const |
Return the current ACE_Timer_Queue. | |
virtual int | close (void) |
Close down the select_reactor and release all of its resources. | |
virtual | ~ACE_Select_Reactor_T (void) |
Close down the select_reactor and release all of its resources. | |
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. | |
virtual int | register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) |
Not implemented. | |
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 . | |
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) |
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 for every signal in . | |
virtual int | suspend_handler (ACE_Event_Handler *eh) |
Temporarily suspend the associated with . | |
virtual int | suspend_handler (ACE_HANDLE handle) |
Temporarily suspend the associated with . | |
virtual int | suspend_handler (const ACE_Handle_Set &handles) |
Suspend all in handle set temporarily. | |
virtual int | suspend_handlers (void) |
Suspend all the in the Select_Reactor. | |
virtual int | resume_handler (ACE_Event_Handler *eh) |
virtual int | resume_handler (ACE_HANDLE handle) |
virtual int | resume_handler (const ACE_Handle_Set &handles) |
Resume all in handle set. | |
virtual int | resume_handlers (void) |
Resume all the in the Select_Reactor. | |
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 and the . | |
virtual int | schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
ADD the dispatch MASK "bit" bound with the and the . | |
virtual int | cancel_wakeup (ACE_Event_Handler *eh, ACE_Reactor_Mask mask) |
CLR the dispatch MASK "bit" bound with the and the . | |
virtual int | cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
CLR the dispatch MASK "bit" bound with the and the . | |
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. | |
virtual int | restart (int r) |
Set a new value for restart and return the original value. | |
virtual void | requeue_position (int) |
virtual int | requeue_position (void) |
virtual int | mask_ops (ACE_Event_Handler *eh, ACE_Reactor_Mask mask, int ops) |
virtual int | mask_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops) |
virtual int | ready_ops (ACE_Event_Handler *eh, ACE_Reactor_Mask mask, int ops) |
GET/SET/ADD/CLR the ready "bit" bound with the and . | |
virtual int | ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask, int ops) |
GET/SET/ADD/CLR the ready "bit" bound with the and . | |
virtual void | wakeup_all_threads (void) |
Wake up all threads in waiting in the event loop. | |
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. | |
virtual int | owner (ACE_thread_t *) |
Return the current owner of the thread. | |
virtual ACE_Event_Handler * | find_handler (ACE_HANDLE handle) |
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 bool | initialized (void) |
Returns true if we've been successfully initialized, else false. | |
virtual size_t | size (void) const |
virtual ACE_Lock & | lock (void) |
virtual void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Member Functions | |
virtual int | register_handler_i (ACE_HANDLE handle, ACE_Event_Handler *eh, ACE_Reactor_Mask mask) |
virtual int | register_handler_i (const ACE_Handle_Set &handles, ACE_Event_Handler *handler, ACE_Reactor_Mask mask) |
Register a set of . | |
virtual int | remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask) |
virtual int | remove_handler_i (const ACE_Handle_Set &handles, ACE_Reactor_Mask) |
Remove a set of . | |
virtual int | suspend_i (ACE_HANDLE handle) |
Suspend the associated with . | |
virtual int | is_suspended_i (ACE_HANDLE handle) |
virtual int | resume_i (ACE_HANDLE handle) |
Resume the associated with . | |
virtual ACE_Event_Handler * | find_handler_i (ACE_HANDLE handle) |
Implement the public method. | |
virtual int | handler_i (ACE_HANDLE handle, ACE_Reactor_Mask, ACE_Event_Handler **=0) |
Implement the public method. | |
virtual int | handler_i (int signum, ACE_Event_Handler **=0) |
Implement the public method. | |
virtual int | any_ready (ACE_Select_Reactor_Handle_Set &handle_set) |
virtual int | any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set) |
virtual int | handle_error (void) |
Take corrective action when errors occur. | |
virtual int | check_handles (void) |
Make sure the handles are all valid. | |
virtual int | wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, ACE_Time_Value *) |
Wait for events to occur. | |
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) |
virtual void | renew (void) |
int | release_token (void) |
Release the token lock when a Win32 structured exception occurs. | |
int | handle_events_i (ACE_Time_Value *max_wait_time=0) |
Stops the VC++ compiler from bitching about exceptions and destructors. | |
Protected Attributes | |
ACE_SELECT_REACTOR_TOKEN | token_ |
Synchronization token for the MT_SAFE ACE_Select_Reactor. | |
ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN > | lock_adapter_ |
Adapter used to return internal lock to outside world. | |
sig_atomic_t | deactivated_ |
Private Member Functions | |
ACE_Select_Reactor_T (const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &) | |
Deny access since member-wise won't work... | |
ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > & | operator= (const ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN > &) |
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_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 55 of file Select_Reactor_T.h.
|
If 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 is 1 the reactor is "signal-safe" when dispatching handlers to signal events, whereas if 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 478 of file Select_Reactor_T.cpp. References ACE_ERROR, ACE_TEXT, ACE_Timer_Queue, ACE_TRACE, and LM_ERROR.
00484 : ACE_Select_Reactor_Impl (mask_signals) 00485 , token_ (s_queue) 00486 , lock_adapter_ (token_) 00487 , deactivated_ (0) 00488 { 00489 ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); 00490 00491 this->token_.reactor (*this); 00492 // First try to open the Reactor with the hard-coded default. 00493 if (this->open (ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::DEFAULT_SIZE, 00494 0, 00495 sh, 00496 tq, 00497 disable_notify_pipe, 00498 notify) == -1) 00499 { 00500 // The hard-coded default Reactor size failed, so attempt to 00501 // determine the size at run-time by checking the process file 00502 // descriptor limit on platforms that support this feature. 00503 00504 // There is no need to deallocate resources from previous open() 00505 // call since the open() method deallocates any resources prior 00506 // to exiting if an error was encountered. 00507 00508 // Set the default reactor size to be the current limit on the 00509 // number of file descriptors available to the process. This 00510 // size is not necessarily the maximum limit. 00511 if (this->open (ACE::max_handles (), 00512 0, 00513 sh, 00514 tq, 00515 disable_notify_pipe, 00516 notify) == -1) 00517 ACE_ERROR ((LM_ERROR, 00518 ACE_TEXT ("%p\n"), 00519 ACE_TEXT ("ACE_Select_Reactor_T::open ") 00520 ACE_TEXT ("failed inside ") 00521 ACE_TEXT ("ACE_Select_Reactor_T::CTOR"))); 00522 } 00523 } |
|
Definition at line 529 of file Select_Reactor_T.cpp. References ACE_ERROR, ACE_TEXT, ACE_Timer_Queue, ACE_TRACE, and LM_ERROR.
00537 : ACE_Select_Reactor_Impl (mask_signals) 00538 , token_ (s_queue) 00539 , lock_adapter_ (token_) 00540 , deactivated_ (0) 00541 { 00542 ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); 00543 00544 this->token_.reactor (*this); 00545 if (this->open (size, 00546 rs, 00547 sh, 00548 tq, 00549 disable_notify_pipe, 00550 notify) == -1) 00551 ACE_ERROR ((LM_ERROR, 00552 ACE_TEXT ("%p\n"), 00553 ACE_TEXT ("ACE_Select_Reactor_T::open ") 00554 ACE_TEXT ("failed inside ACE_Select_Reactor_T::CTOR"))); 00555 } |
|
Close down the select_reactor and release all of its resources.
Definition at line 606 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::close().
|
|
Deny access since member-wise won't work...
|
|
Implements ACE_Reactor_Impl. Definition at line 206 of file Select_Reactor_T.inl. References ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events().
00207 { 00208 return this->handle_events (max_wait_time); 00209 } |
|
Implements ACE_Reactor_Impl. Definition at line 200 of file Select_Reactor_T.inl. References ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events().
00201 { 00202 return this->handle_events (max_wait_time); 00203 } |
|
Check if there are any HANDLEs enabled in the , and if so, update the and return the number ready. If there aren't any HANDLEs enabled return 0. Definition at line 45 of file Select_Reactor_T.cpp. References ACE_TRACE.
00046 { 00047 ACE_TRACE ("ACE_Select_Reactor_T::any_ready"); 00048 00049 if (this->mask_signals_) 00050 { 00051 #if !defined (ACE_WIN32) 00052 // Make this call signal safe. 00053 ACE_Sig_Guard sb; 00054 #endif /* ACE_WIN32 */ 00055 00056 return this->any_ready_i (wait_set); 00057 } 00058 return this->any_ready_i (wait_set); 00059 } |
|
Implement the method, assuming that the Sig_Guard is beign held Definition at line 63 of file Select_Reactor_T.cpp. References ACE_TRACE.
00064 { 00065 ACE_TRACE ("ACE_Select_Reactor_T::any_ready_i"); 00066 00067 int number_ready = this->ready_set_.rd_mask_.num_set () 00068 + this->ready_set_.wr_mask_.num_set () 00069 + this->ready_set_.ex_mask_.num_set (); 00070 00071 // number_ready > 0 meaning there are handles in the ready_set 00072 // &wait_set != &(this->ready_set_) means that we need to copy 00073 // the handles from the ready_set to the wait set because the 00074 // wait_set_ doesn't contain all the handles in the ready_set_ 00075 if (number_ready > 0 && &wait_set != &(this->ready_set_)) 00076 { 00077 wait_set.rd_mask_ = this->ready_set_.rd_mask_; 00078 wait_set.wr_mask_ = this->ready_set_.wr_mask_; 00079 wait_set.ex_mask_ = this->ready_set_.ex_mask_; 00080 00081 this->ready_set_.rd_mask_.reset (); 00082 this->ready_set_.wr_mask_.reset (); 00083 this->ready_set_.ex_mask_.reset (); 00084 } 00085 00086 return number_ready; 00087 } |
|
Cancel the single ACE_Event_Handler that matches the value (which was returned from the method). If arg is non-NULL then it will be set to point to the ``magic cookie'' argument passed in when the was registered. This makes it possible to free up the memory and avoid memory leaks. If is 0 then the method of will be invoked. Returns 1 if cancellation succeeded and 0 if the wasn't found. Implements ACE_Reactor_Impl. Definition at line 704 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::cancel().
00707 { 00708 ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer"); 00709 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00710 00711 if (this->timer_queue_ != 0) 00712 return this->timer_queue_->cancel (timer_id, 00713 arg, 00714 dont_call_handle_close); 00715 else 00716 return 0; 00717 } |
|
Cancel all that match the address of . If is 0 then the method of will be invoked. Returns number of handler's cancelled. Implements ACE_Reactor_Impl. Definition at line 691 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::cancel().
00693 { 00694 ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer"); 00695 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00696 00697 if (this->timer_queue_ != 0) 00698 return this->timer_queue_->cancel (handler, dont_call_handle_close); 00699 else 00700 return 0; 00701 } |
|
CLR the dispatch MASK "bit" bound with the and the .
Implements ACE_Reactor_Impl. Definition at line 177 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops().
|
|
CLR the dispatch MASK "bit" bound with the and the .
Implements ACE_Reactor_Impl. Definition at line 161 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, ACE_Event_Handler::get_handle(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops().
00163 { 00164 ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup"); 00165 return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); 00166 } |
|
Make sure the handles are all valid.
Definition at line 1462 of file Select_Reactor_T.cpp. References ACE_TRACE, ACE_Handle_Set::clr_bit(), ACE_OS::fstat(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::remove_handler_i(), ACE_OS::select(), and ACE_Handle_Set::set_bit(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_error().
01463 { 01464 ACE_TRACE ("ACE_Select_Reactor_T::check_handles"); 01465 01466 #if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_VXWORKS) 01467 ACE_Time_Value time_poll = ACE_Time_Value::zero; 01468 ACE_Handle_Set rd_mask; 01469 #endif /* ACE_WIN32 || MVS || ACE_VXWORKS */ 01470 01471 int result = 0; 01472 01473 /* 01474 * It's easier to run through the handler repository iterator, but that 01475 * misses handles that are registered on a handler that doesn't implement 01476 * get_handle(). So, build a handle set that's the union of the three 01477 * wait_sets (rd, wrt, ex) and run through that. Bad handles get cleared 01478 * out of all sets. 01479 */ 01480 ACE_HANDLE h; 01481 ACE_Handle_Set check_set (this->wait_set_.rd_mask_); 01482 ACE_Handle_Set_Iterator wr_iter (this->wait_set_.wr_mask_); 01483 while ((h = wr_iter ()) != ACE_INVALID_HANDLE) 01484 check_set.set_bit (h); 01485 ACE_Handle_Set_Iterator ex_iter (this->wait_set_.ex_mask_); 01486 while ((h = ex_iter ()) != ACE_INVALID_HANDLE) 01487 check_set.set_bit (h); 01488 01489 ACE_Handle_Set_Iterator check_iter (check_set); 01490 while ((h = check_iter ()) != ACE_INVALID_HANDLE) 01491 { 01492 01493 #if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_VXWORKS) 01494 // Win32 needs to do the check this way because fstat won't work on 01495 // a socket handle. MVS Open Edition needs to do it this way because, 01496 // even though the docs say to check a handle with either select or 01497 // fstat, the fstat method always says the handle is ok. 01498 // pSOS needs to do it this way because file handles and socket handles 01499 // are maintained by separate pieces of the system. VxWorks needs the select 01500 // variant since fstat always returns an error on socket FDs. 01501 rd_mask.set_bit (h); 01502 01503 int select_width; 01504 # if defined (ACE_WIN32) 01505 // This arg is ignored on Windows and causes pointer truncation 01506 // warnings on 64-bit compiles. 01507 select_width = 0; 01508 # else 01509 select_width = int (h) + 1; 01510 # endif /* ACE_WIN32 */ 01511 01512 if (ACE_OS::select (select_width, 01513 rd_mask, 0, 0, 01514 &time_poll) < 0) 01515 { 01516 result = 1; 01517 this->remove_handler_i (h, ACE_Event_Handler::ALL_EVENTS_MASK); 01518 } 01519 rd_mask.clr_bit (h); 01520 #else /* !ACE_WIN32 && !MVS && !VXWORKS */ 01521 struct stat temp; 01522 01523 if (ACE_OS::fstat (h, &temp) == -1) 01524 { 01525 result = 1; 01526 this->remove_handler_i (h, ACE_Event_Handler::ALL_EVENTS_MASK); 01527 } 01528 #endif /* ACE_WIN32 || MVS */ 01529 } 01530 01531 return result; 01532 } |
|
Close down the select_reactor and release all of its resources.
Implements ACE_Reactor_Impl. Definition at line 562 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, ACE_Reactor_Notify::close(), and ACE_Select_Reactor_Handler_Repository::close(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::~ACE_Select_Reactor_T().
00563 { 00564 ACE_TRACE ("ACE_Select_Reactor_T::close"); 00565 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00566 00567 if (this->delete_signal_handler_) 00568 { 00569 delete this->signal_handler_; 00570 this->signal_handler_ = 0; 00571 this->delete_signal_handler_ = false; 00572 } 00573 00574 this->handler_rep_.close (); 00575 00576 if (this->delete_timer_queue_) 00577 { 00578 delete this->timer_queue_; 00579 this->timer_queue_ = 0; 00580 this->delete_timer_queue_ = false; 00581 } 00582 00583 if (this->notify_handler_ != 0) 00584 this->notify_handler_->close (); 00585 00586 if (this->delete_notify_handler_) 00587 { 00588 delete this->notify_handler_; 00589 this->notify_handler_ = 0; 00590 this->delete_notify_handler_ = false; 00591 } 00592 00593 this->initialized_ = false; 00594 00595 return 0; 00596 } |
|
Returns -1 (not used in this implementation);.
Implements ACE_Reactor_Impl. Definition at line 600 of file Select_Reactor_T.cpp.
00601 {
00602 return -1;
00603 }
|
|
Control whether the Reactor will handle any more incoming events or not. If == 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 218 of file Select_Reactor_T.inl. References ACE_GUARD, ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivated_, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::wakeup_all_threads().
00219 { 00220 { 00221 ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, 00222 ace_mon, 00223 this->token_)); 00224 this->deactivated_ = do_stop; 00225 } 00226 00227 this->wakeup_all_threads (); 00228 } |
|
Return the status of Reactor. If this function returns 0, the reactor is actively handling events. If it returns non-zero, and return -1 immediately. Implements ACE_Reactor_Impl. Definition at line 212 of file Select_Reactor_T.inl. References ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivated_.
00213 { 00214 return this->deactivated_; 00215 } |
|
Template Method that dispatches ACE_Event_Handlers for time events, I/O events, and signal events. Returns the total number of ACE_Event_Handlers that were dispatched or -1 if something goes wrong. Definition at line 1280 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_Sig_Handler::sig_pending().
01282 { 01283 ACE_TRACE ("ACE_Select_Reactor_T::dispatch"); 01284 01285 int io_handlers_dispatched = 0; 01286 int other_handlers_dispatched = 0; 01287 int signal_occurred = 0; 01288 // The following do/while loop keeps dispatching as long as there 01289 // are still active handles. Note that the only way we should ever 01290 // iterate more than once through this loop is if signals occur 01291 // while we're dispatching other handlers. 01292 01293 do 01294 { 01295 // We expect that the loop will decrease the number of active 01296 // handles in each iteration. If it does not, then something is 01297 // inconsistent in the state of the Reactor and we should avoid 01298 // the loop. Please read the comments on bug 2540 for more 01299 // details. 01300 int initial_handle_count = active_handle_count; 01301 01302 // Note that we keep track of changes to our state. If any of 01303 // the dispatch_*() methods below return -1 it means that the 01304 // <wait_set_> state has changed as the result of an 01305 // <ACE_Event_Handler> being dispatched. This means that we 01306 // need to bail out and rerun the select() loop since our 01307 // existing notion of handles in <dispatch_set> may no longer be 01308 // correct. 01309 // 01310 // In the beginning, our state starts out unchanged. After 01311 // every iteration (i.e., due to signals), our state starts out 01312 // unchanged again. 01313 01314 this->state_changed_ = false; 01315 01316 // Perform the Template Method for dispatching all the handlers. 01317 01318 // First check for interrupts. 01319 if (active_handle_count == -1) 01320 { 01321 // Bail out -- we got here since <select> was interrupted. 01322 if (ACE_Sig_Handler::sig_pending () != 0) 01323 { 01324 ACE_Sig_Handler::sig_pending (0); 01325 01326 // If any HANDLES in the <ready_set_> are activated as a 01327 // result of signals they should be dispatched since 01328 // they may be time critical... 01329 active_handle_count = this->any_ready (dispatch_set); 01330 01331 // Record the fact that the Reactor has dispatched a 01332 // handle_signal() method. We need this to return the 01333 // appropriate count below. 01334 signal_occurred = 1; 01335 } 01336 else 01337 return -1; 01338 } 01339 01340 // Handle timers early since they may have higher latency 01341 // constraints than I/O handlers. Ideally, the order of 01342 // dispatching should be a strategy... 01343 else if (this->dispatch_timer_handlers (other_handlers_dispatched) == -1) 01344 // State has changed or timer queue has failed, exit loop. 01345 break; 01346 01347 // Check to see if there are no more I/O handles left to 01348 // dispatch AFTER we've handled the timers... 01349 else if (active_handle_count == 0) 01350 return io_handlers_dispatched 01351 + other_handlers_dispatched 01352 + signal_occurred; 01353 01354 // Next dispatch the notification handlers (if there are any to 01355 // dispatch). These are required to handle multi-threads that 01356 // are trying to update the <Reactor>. 01357 01358 else if (this->dispatch_notification_handlers 01359 (dispatch_set, 01360 active_handle_count, 01361 other_handlers_dispatched) == -1) 01362 // State has changed or a serious failure has occured, so exit 01363 // loop. 01364 break; 01365 01366 // Finally, dispatch the I/O handlers. 01367 else if (this->dispatch_io_handlers 01368 (dispatch_set, 01369 active_handle_count, 01370 io_handlers_dispatched) == -1) 01371 // State has changed, so exit loop. 01372 break; 01373 01374 // if state changed, we need to re-eval active_handle_count, 01375 // so we will not end with an endless loop 01376 if (initial_handle_count == active_handle_count 01377 || this->state_changed_) 01378 { 01379 active_handle_count = this->any_ready (dispatch_set); 01380 } 01381 } 01382 while (active_handle_count > 0); 01383 01384 return io_handlers_dispatched + other_handlers_dispatched + signal_occurred; 01385 } |
|
Dispatch all the input/output/except handlers that are enabled in the . Updates and according to the behavior of the number Returns -1 if the state of the has changed, else 0. Definition at line 1229 of file Select_Reactor_T.cpp. References ACE_TRACE.
01232 { 01233 ACE_TRACE ("ACE_Select_Reactor_T::dispatch_io_handlers"); 01234 01235 // Handle output events (this code needs to come first to handle the 01236 // obscure case of piggy-backed data coming along with the final 01237 // handshake message of a nonblocking connection). 01238 01239 if (this->dispatch_io_set (number_of_active_handles, 01240 number_of_handlers_dispatched, 01241 ACE_Event_Handler::WRITE_MASK, 01242 dispatch_set.wr_mask_, 01243 this->ready_set_.wr_mask_, 01244 &ACE_Event_Handler::handle_output) == -1) 01245 { 01246 number_of_active_handles -= number_of_handlers_dispatched; 01247 return -1; 01248 } 01249 01250 // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Select_Reactor_T::dispatch - EXCEPT\n"))); 01251 if (this->dispatch_io_set (number_of_active_handles, 01252 number_of_handlers_dispatched, 01253 ACE_Event_Handler::EXCEPT_MASK, 01254 dispatch_set.ex_mask_, 01255 this->ready_set_.ex_mask_, 01256 &ACE_Event_Handler::handle_exception) == -1) 01257 { 01258 number_of_active_handles -= number_of_handlers_dispatched; 01259 return -1; 01260 } 01261 01262 // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Select_Reactor_T::dispatch - READ\n"))); 01263 if (this->dispatch_io_set (number_of_active_handles, 01264 number_of_handlers_dispatched, 01265 ACE_Event_Handler::READ_MASK, 01266 dispatch_set.rd_mask_, 01267 this->ready_set_.rd_mask_, 01268 &ACE_Event_Handler::handle_input) == -1) 01269 { 01270 number_of_active_handles -= number_of_handlers_dispatched; 01271 return -1; 01272 } 01273 01274 number_of_active_handles -= number_of_handlers_dispatched; 01275 return 0; 01276 } |
|
Factors the dispatching of an io handle set (each WRITE, EXCEPT or READ set of handles). It updates the and invokes this->notify_handle for all the handles in using the , and parameters. Must return -1 if this->state_changed otherwise it must return 0. Reimplemented in ACE_Priority_Reactor. Definition at line 1188 of file Select_Reactor_T.cpp. References ACE_EH_PTMF, and ACE_TRACE.
01194 { 01195 ACE_TRACE ("ACE_Select_Reactor_T::dispatch_io_set"); 01196 ACE_HANDLE handle; 01197 01198 ACE_Handle_Set_Iterator handle_iter (dispatch_mask); 01199 01200 while ((handle = handle_iter ()) != ACE_INVALID_HANDLE && 01201 number_of_handlers_dispatched < number_of_active_handles) 01202 { 01203 ++number_of_handlers_dispatched; 01204 01205 this->notify_handle (handle, 01206 mask, 01207 ready_mask, 01208 this->handler_rep_.find (handle), 01209 callback); 01210 01211 // clear the bit from that dispatch mask, 01212 // so when we need to restart the iteration (rebuilding the iterator...) 01213 // we will not dispatch the already dispatched handlers 01214 this->clear_dispatch_mask (handle, mask); 01215 01216 if (this->state_changed_) 01217 { 01218 01219 handle_iter.reset_state (); 01220 this->state_changed_ = false; 01221 } 01222 } 01223 01224 return 0; 01225 } |
|
Dispatch any notification handlers. Returns -1 if the state of the has changed, else returns number of handlers notified. Definition at line 1155 of file Select_Reactor_T.cpp.
01158 { 01159 // Check to see if the ACE_HANDLE associated with the 01160 // Select_Reactor's notify hook is enabled. If so, it means that 01161 // one or more other threads are trying to update the 01162 // ACE_Select_Reactor_T's internal tables or the notify pipe is 01163 // enabled. We'll handle all these threads and notifications, and 01164 // then break out to continue the event loop. 01165 int const n = 01166 this->notify_handler_->dispatch_notifications (number_of_active_handles, 01167 dispatch_set.rd_mask_); 01168 01169 if (n == -1) 01170 return -1; 01171 else 01172 { 01173 number_of_handlers_dispatched += n; 01174 number_of_active_handles -= n; 01175 } 01176 01177 // Same as dispatch_timer_handlers 01178 // No need to do anything with the state changed. That is because 01179 // unbind already handles the case where someone unregister some 01180 // kind of handle and unbind it. (::unbind calls the function 01181 // state_changed () to reflect ant change with that) 01182 // return this->state_changed_ ? -1 : 0; 01183 return 0; 01184 } |
|
Dispatch all timer handlers that have expired. Returns -1 if the state of the has changed, else 0. is set to the number of timer handlers dispatched. Definition at line 1146 of file Select_Reactor_T.cpp.
01147 { 01148 number_of_handlers_dispatched += this->timer_queue_->expire (); 01149 01150 return 0; 01151 } |
|
Dump the state of an object.
Implements ACE_Reactor_Impl. Reimplemented in ACE_Priority_Reactor. Definition at line 1535 of file Select_Reactor_T.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, ACE_Reactor_Notify::dump(), ACE_Sig_Handler::dump(), ACE_Select_Reactor_Handler_Repository::dump(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::dump(), LM_DEBUG, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::token_. Referenced by ACE_Priority_Reactor::dump().
01536 { 01537 #if defined (ACE_HAS_DUMP) 01538 ACE_TRACE ("ACE_Select_Reactor_T::dump"); 01539 01540 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 01541 01542 this->timer_queue_->dump (); 01543 this->handler_rep_.dump (); 01544 this->signal_handler_->dump (); 01545 ACE_DEBUG ((LM_DEBUG, 01546 ACE_TEXT ("delete_signal_handler_ = %d\n"), 01547 this->delete_signal_handler_)); 01548 01549 ACE_HANDLE h; 01550 01551 for (ACE_Handle_Set_Iterator handle_iter_wr (this->wait_set_.wr_mask_); 01552 (h = handle_iter_wr ()) != ACE_INVALID_HANDLE;) 01553 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("write_handle = %d\n"), h)); 01554 01555 for (ACE_Handle_Set_Iterator handle_iter_rd (this->wait_set_.rd_mask_); 01556 (h = handle_iter_rd ()) != ACE_INVALID_HANDLE;) 01557 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("read_handle = %d\n"), h)); 01558 01559 for (ACE_Handle_Set_Iterator handle_iter_ex (this->wait_set_.ex_mask_); 01560 (h = handle_iter_ex ()) != ACE_INVALID_HANDLE;) 01561 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("except_handle = %d\n"), h)); 01562 01563 for (ACE_Handle_Set_Iterator handle_iter_wr_ready (this->ready_set_.wr_mask_); 01564 (h = handle_iter_wr_ready ()) != ACE_INVALID_HANDLE;) 01565 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("write_handle_ready = %d\n"), h)); 01566 01567 for (ACE_Handle_Set_Iterator handle_iter_rd_ready (this->ready_set_.rd_mask_); 01568 (h = handle_iter_rd_ready ()) != ACE_INVALID_HANDLE;) 01569 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("read_handle_ready = %d\n"), h)); 01570 01571 for (ACE_Handle_Set_Iterator handle_iter_ex_ready (this->ready_set_.ex_mask_); 01572 (h = handle_iter_ex_ready ()) != ACE_INVALID_HANDLE;) 01573 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("except_handle_ready = %d\n"), h)); 01574 01575 for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.wr_mask_); 01576 (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE;) 01577 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("write_handle_suspend = %d\n"), h)); 01578 01579 for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.rd_mask_); 01580 (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE;) 01581 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("read_handle_suspend = %d\n"), h)); 01582 01583 for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.ex_mask_); 01584 (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE;) 01585 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("except_handle_suspend = %d\n"), h)); 01586 01587 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_)); 01588 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("requeue_position_ = %d\n"), this->requeue_position_)); 01589 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("initialized_ = %d\n"), this->initialized_)); 01590 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("owner_ = %d\n"), this->owner_)); 01591 01592 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) 01593 this->notify_handler_->dump (); 01594 this->token_.dump (); 01595 #endif /* ACE_MT_SAFE */ 01596 01597 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 01598 #endif /* ACE_HAS_DUMP */ 01599 } |
|
Return the Event_Handler associated with . Return 0 if is not registered. Implements ACE_Reactor_Impl. Definition at line 299 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, and ACE_TRACE.
00300 { 00301 ACE_TRACE ("ACE_Select_Reactor_T::find_handler"); 00302 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, 0)); 00303 return this->find_handler_i (handle); 00304 } |
|
Implement the public method.
Definition at line 865 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_Event_Handler::add_reference().
00866 { 00867 ACE_TRACE ("ACE_Select_Reactor_T::find_handler_i"); 00868 00869 ACE_Event_Handler *event_handler = 00870 this->handler_rep_.find (handle); 00871 00872 if (event_handler) 00873 event_handler->add_reference (); 00874 00875 return event_handler; 00876 } |
|
Take corrective action when errors occur.
Definition at line 768 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::check_handles().
00769 { 00770 ACE_TRACE ("ACE_Select_Reactor_T::handle_error"); 00771 #if defined (linux) && defined (ERESTARTNOHAND) 00772 int const error = errno; // Avoid multiple TSS accesses. 00773 if (error == EINTR || error == ERESTARTNOHAND) 00774 return this->restart_; 00775 #else 00776 if (errno == EINTR) 00777 return this->restart_; 00778 #endif /* linux && ERESTARTNOHAND */ 00779 #if defined (__MVS__) || defined (ACE_WIN32) || defined (ACE_VXWORKS) 00780 // On MVS Open Edition and Win32, there can be a number of failure 00781 // codes on a bad socket, so check_handles on anything other than 00782 // EINTR. VxWorks doesn't even bother to always set errno on error 00783 // in select (specifically, it doesn't return EBADF for bad FDs). 00784 else 00785 return this->check_handles (); 00786 #else 00787 else if (errno == EBADF) 00788 return this->check_handles (); 00789 else 00790 return -1; 00791 #endif /* __MVS__ || ACE_WIN32 */ 00792 } |
|
This method is just like the one above, except the max_wait_time value is a reference and can therefore never be NULL. Current is identical to . Implements ACE_Reactor_Impl. Reimplemented in ACE_TP_Reactor. Definition at line 760 of file Select_Reactor_T.cpp. References ACE_TRACE.
00761 { 00762 ACE_TRACE ("ACE_Select_Reactor_T::handle_events"); 00763 00764 return this->handle_events (&max_wait_time); 00765 } |
|
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 is identical to . Implements ACE_Reactor_Impl. Reimplemented in ACE_TP_Reactor. Definition at line 1400 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, ACE_OS::thr_equal(), and ACE_Countdown_Time::update(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::alertable_handle_events().
01401 { 01402 ACE_TRACE ("ACE_Select_Reactor_T::handle_events"); 01403 01404 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) 01405 01406 // Stash the current time -- the destructor of this object will 01407 // automatically compute how much time elapsed since this method was 01408 // called. 01409 ACE_Countdown_Time countdown (max_wait_time); 01410 01411 ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1); 01412 01413 if (ACE_OS::thr_equal (ACE_Thread::self (), 01414 this->owner_) == 0 || this->deactivated_) 01415 return -1; 01416 01417 // Update the countdown to reflect time waiting for the mutex. 01418 countdown.update (); 01419 #else 01420 if (this->deactivated_) 01421 return -1; 01422 #endif /* ACE_MT_SAFE */ 01423 01424 return this->handle_events_i (max_wait_time); 01425 } |
|
Stops the VC++ compiler from bitching about exceptions and destructors.
Definition at line 1429 of file Select_Reactor_T.cpp. References ACE_SEH_EXCEPT, and ACE_SEH_TRY.
01430 { 01431 int result = -1; 01432 01433 ACE_SEH_TRY 01434 { 01435 // We use the data member dispatch_set_ as the current dispatch 01436 // set. 01437 01438 // We need to start from a clean dispatch_set 01439 this->dispatch_set_.rd_mask_.reset (); 01440 this->dispatch_set_.wr_mask_.reset (); 01441 this->dispatch_set_.ex_mask_.reset (); 01442 01443 int number_of_active_handles = 01444 this->wait_for_multiple_events (this->dispatch_set_, 01445 max_wait_time); 01446 01447 result = 01448 this->dispatch (number_of_active_handles, 01449 this->dispatch_set_); 01450 } 01451 ACE_SEH_EXCEPT (this->release_token ()) 01452 { 01453 // As it stands now, we catch and then rethrow all Win32 01454 // structured exceptions so that we can make sure to release the 01455 // <token_> lock correctly. 01456 } 01457 01458 return result; 01459 } |
|
Check to see if signum is associated with a valid Event_Handler bound to a signal. Return the associated with this if != 0. Implements ACE_Reactor_Impl. Definition at line 101 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler_i().
|
|
Check to see if is associated with a valid Event_Handler bound to . Return the associated with this if != 0. Implements ACE_Reactor_Impl. Definition at line 308 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
|
|
Implement the public method.
Definition at line 90 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_Sig_Handler::handler().
00092 { 00093 ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); 00094 ACE_Event_Handler *handler = this->signal_handler_->handler (signum); 00095 00096 if (handler == 0) 00097 return -1; 00098 else if (eh != 0) 00099 *eh = handler; 00100 return 0; 00101 } |
|
Implement the public method.
Definition at line 882 of file Select_Reactor_T.cpp. References ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_TRACE, and ACE_Event_Handler::add_reference(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handler().
00885 { 00886 ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); 00887 ACE_Event_Handler *event_handler = 00888 this->handler_rep_.find (handle); 00889 00890 if (event_handler == 0) 00891 return -1; 00892 else 00893 { 00894 if ((ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) 00895 || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) 00896 && this->wait_set_.rd_mask_.is_set (handle) == 0) 00897 return -1; 00898 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) 00899 && this->wait_set_.wr_mask_.is_set (handle) == 0) 00900 return -1; 00901 if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK) 00902 && this->wait_set_.ex_mask_.is_set (handle) == 0) 00903 return -1; 00904 } 00905 00906 if (eh != 0) 00907 { 00908 *eh = event_handler; 00909 event_handler->add_reference (); 00910 } 00911 00912 return 0; 00913 } |
|
Returns true if we've been successfully initialized, else false.
Implements ACE_Reactor_Impl. Definition at line 104 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, and ACE_TRACE.
00105 { 00106 ACE_TRACE ("ACE_Select_Reactor_T::initialized"); 00107 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, false)); 00108 return this->initialized_; 00109 } |
|
Check to see if the associated with is suspended. Returns 0 if not, 1 if so. Implements ACE_Select_Reactor_Impl. Definition at line 977 of file Select_Reactor_T.cpp. References ACE_TRACE, ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::find(), ACE_Handle_Set::is_set(), ACE_Select_Reactor_Handle_Set::rd_mask_, and ACE_Select_Reactor_Handle_Set::wr_mask_. Referenced by ACE_TP_Reactor::get_socket_event_info().
00978 { 00979 ACE_TRACE ("ACE_Select_Reactor_T::is_suspended_i"); 00980 if (this->handler_rep_.find (handle) == 0) 00981 return 0; 00982 00983 return this->suspend_set_.rd_mask_.is_set (handle) || 00984 this->suspend_set_.wr_mask_.is_set (handle) || 00985 this->suspend_set_.ex_mask_.is_set (handle) ; 00986 00987 } |
|
Returns a reference to the ACE_Reactor_Token that is used to serialize the internal 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 185 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::lock_adapter_.
00186 { 00187 ACE_TRACE ("ACE_Select_Reactor_T::lock"); 00188 return this->lock_adapter_; 00189 } |
|
GET/SET/ADD/CLR the dispatch MASK "bit" bound with the and . Implements ACE_Reactor_Impl. Definition at line 843 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00846 { 00847 ACE_TRACE ("ACE_Select_Reactor_T::mask_ops"); 00848 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00849 00850 // If the handle is not suspended, then set the ops on the 00851 // <wait_set_>, otherwise set the <suspend_set_>. 00852 00853 if (this->is_suspended_i (handle)) 00854 return this->bit_ops (handle, mask, 00855 this->suspend_set_, 00856 ops); 00857 else 00858 return this->bit_ops (handle, mask, 00859 this->wait_set_, 00860 ops); 00861 } |
|
GET/SET/ADD/CLR the dispatch mask "bit" bound with the and . Implements ACE_Reactor_Impl. Definition at line 144 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, and ACE_Event_Handler::get_handle(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::cancel_wakeup(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::schedule_wakeup().
00147 { 00148 ACE_TRACE ("ACE_Select_Reactor_T::mask_ops"); 00149 return this->mask_ops (handler->get_handle (), mask, ops); 00150 } |
|
Get the maximum number of times that the <ACE_Select_Reactor_Notify::handle_input> method will iterate and dispatch the that are passed in via the notify pipe before breaking out of its loop. Implements ACE_Reactor_Impl. Definition at line 184 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Reactor_Notify::max_notify_iterations().
00185 { 00186 ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations"); 00187 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00188 return this->notify_handler_->max_notify_iterations (); 00189 } |
|
Set the maximum number of times that the <ACE_Select_Reactor_Notify::handle_input> method will iterate and dispatch the that are passed in via the notify pipe before breaking out of its 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 175 of file Select_Reactor_T.cpp. References ACE_GUARD, ACE_TRACE, and ACE_Reactor_Notify::max_notify_iterations().
00176 { 00177 ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations"); 00178 ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_)); 00179 00180 this->notify_handler_->max_notify_iterations (iterations); 00181 } |
|
Called by a thread when it wants to unblock the Select_Reactor. This wakeups the if currently blocked in /. Pass over both the *and* the to allow the caller to dictate which method the will invoke. The ACE_Time_Value indicates how long to blocking trying to notify the . 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 203 of file Select_Reactor_T.cpp. References ACE_Reactor_Mask, ACE_TRACE, ACE_Reactor_Notify::notify(), and ssize_t. Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::wakeup_all_threads().
00206 { 00207 ACE_TRACE ("ACE_Select_Reactor_T::notify"); 00208 00209 // Pass over both the Event_Handler *and* the mask to allow the 00210 // caller to dictate which Event_Handler method the receiver 00211 // invokes. Note that this call can timeout. 00212 00213 ssize_t const n = this->notify_handler_->notify (eh, mask, timeout); 00214 return n == -1 ? -1 : 0; 00215 } |
|
Notify the appropriate in the context of the associated with that a particular event has occurred. Reimplemented in ACE_TP_Reactor. Definition at line 796 of file Select_Reactor_T.cpp. References ACE_EH_PTMF, ACE_Reactor_Mask, and ACE_TRACE. Referenced by ACE_Priority_Reactor::dispatch_io_set().
00801 { 00802 ACE_TRACE ("ACE_Select_Reactor_T::notify_handle"); 00803 // Check for removed handlers. 00804 if (event_handler == 0) 00805 return; 00806 00807 bool const reference_counting_required = 00808 event_handler->reference_counting_policy ().value () == 00809 ACE_Event_Handler::Reference_Counting_Policy::ENABLED; 00810 00811 // Call add_reference() if needed. 00812 if (reference_counting_required) 00813 { 00814 event_handler->add_reference (); 00815 } 00816 00817 int status = (event_handler->*ptmf) (handle); 00818 00819 if (status < 0) 00820 this->remove_handler_i (handle, mask); 00821 else if (status > 0) 00822 ready_mask.set_bit (handle); 00823 00824 // Call remove_reference() if needed. 00825 if (reference_counting_required) 00826 event_handler->remove_reference (); 00827 } |
|
Initialize the
Implements ACE_Reactor_Impl. Definition at line 365 of file Select_Reactor_T.cpp. References ACE_ERROR, ACE_GUARD_RETURN, ACE_NEW_RETURN, ACE_TEXT, ACE_Timer_Heap, ACE_Timer_Queue, ACE_TRACE, LM_ERROR, and ACE_Thread::self().
00371 { 00372 ACE_TRACE ("ACE_Select_Reactor_T::open"); 00373 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00374 00375 // Can't initialize ourselves more than once. 00376 if (this->initialized_) 00377 return -1; 00378 00379 this->owner_ = ACE_Thread::self (); 00380 this->restart_ = restart; 00381 this->signal_handler_ = sh; 00382 this->timer_queue_ = tq; 00383 this->notify_handler_ = notify; 00384 00385 int result = 0; 00386 00387 // Allows the signal handler to be overridden. 00388 if (this->signal_handler_ == 0) 00389 { 00390 ACE_NEW_RETURN (this->signal_handler_, 00391 ACE_Sig_Handler, 00392 -1); 00393 00394 if (this->signal_handler_ == 0) 00395 result = -1; 00396 else 00397 this->delete_signal_handler_ = 1; 00398 } 00399 00400 // Allows the timer queue to be overridden. 00401 if (result != -1 && this->timer_queue_ == 0) 00402 { 00403 ACE_NEW_RETURN (this->timer_queue_, 00404 ACE_Timer_Heap, 00405 -1); 00406 00407 if (this->timer_queue_ == 0) 00408 result = -1; 00409 else 00410 this->delete_timer_queue_ = true; 00411 } 00412 00413 // Allows the Notify_Handler to be overridden. 00414 if (result != -1 && this->notify_handler_ == 0) 00415 { 00416 ACE_NEW_RETURN (this->notify_handler_, 00417 ACE_Select_Reactor_Notify, 00418 -1); 00419 00420 if (this->notify_handler_ == 0) 00421 result = -1; 00422 else 00423 this->delete_notify_handler_ = true; 00424 } 00425 00426 if (result != -1 && this->handler_rep_.open (size) == -1) 00427 result = -1; 00428 else if (this->notify_handler_->open (this, 00429 0, 00430 disable_notify_pipe) == -1) 00431 { 00432 ACE_ERROR ((LM_ERROR, 00433 ACE_TEXT ("%p\n"), 00434 ACE_TEXT ("notification pipe open failed"))); 00435 result = -1; 00436 } 00437 00438 if (result != -1) 00439 // We're all set to go. 00440 this->initialized_ = true; 00441 else 00442 // This will close down all the allocated resources properly. 00443 this->close (); 00444 00445 return result; 00446 } |
|
|
|
Return the current owner of the thread.
Implements ACE_Reactor_Impl. Reimplemented in ACE_TP_Reactor. Definition at line 128 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, and ACE_TRACE.
|
|
Set the new owner of the thread and return the old owner.
Implements ACE_Reactor_Impl. Reimplemented in ACE_TP_Reactor. Definition at line 113 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, and ACE_TRACE.
|
|
GET/SET/ADD/CLR the ready "bit" bound with the and .
Implements ACE_Reactor_Impl. Definition at line 351 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
|
|
GET/SET/ADD/CLR the ready "bit" bound with the and .
Implements ACE_Reactor_Impl. Definition at line 133 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, and ACE_Event_Handler::get_handle().
00136 { 00137 ACE_TRACE ("ACE_Select_Reactor_T::ready_ops"); 00138 return this->ready_ops (handler->get_handle (), mask, ops); 00139 } |
|
Registers new_sh to handle a set of signals sigset using the new_disp. Implements ACE_Reactor_Impl. Definition at line 648 of file Select_Reactor_T.cpp. References ACE_NSIG, and ACE_TRACE.
00651 { 00652 ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); 00653 00654 int result = 0; 00655 00656 #if (ACE_NSIG > 0) 00657 for (int s = 1; s < ACE_NSIG; ++s) 00658 if ((sigset.is_member (s) == 1) 00659 && this->signal_handler_->register_handler (s, 00660 new_sh, 00661 new_disp) == -1) 00662 result = -1; 00663 #else /* ACE_NSIG <= 0 */ 00664 ACE_UNUSED_ARG (sigset); 00665 ACE_UNUSED_ARG (new_sh); 00666 ACE_UNUSED_ARG (new_disp); 00667 #endif /* ACE_NSIG <= 0 */ 00668 return result; 00669 } |
|
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 63 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Sig_Handler::register_handler().
00068 { 00069 ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); 00070 return this->signal_handler_->register_handler (signum, 00071 new_sh, new_disp, 00072 old_sh, old_disp); 00073 } |
|
Register eh with all the handles in the .
Implements ACE_Reactor_Impl. Definition at line 288 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00291 { 00292 ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); 00293 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00294 return this->register_handler_i (handles, handler, mask); 00295 } |
|
Not implemented.
Implements ACE_Reactor_Impl. Definition at line 90 of file Select_Reactor_T.inl. References ACE_NOTSUP_RETURN, and ACE_Reactor_Mask.
00094 { 00095 // Don't have an implementation for this yet... 00096 ACE_NOTSUP_RETURN (-1); 00097 } |
|
Not implemented.
Implements ACE_Reactor_Impl. Definition at line 79 of file Select_Reactor_T.inl. References ACE_NOTSUP_RETURN.
00081 { 00082 // Don't have an implementation for this yet... 00083 ACE_NOTSUP_RETURN (-1); 00084 } |
|
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 277 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00280 { 00281 ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); 00282 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00283 return this->register_handler_i (handle, handler, mask); 00284 } |
|
Register a eh with a particular mask. Note that the will call <ACE_Event_Handler::get_handle> to extract the underlying I/O handle. Implements ACE_Reactor_Impl. Definition at line 267 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00269 { 00270 ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); 00271 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00272 return this->register_handler_i (handler->get_handle (), handler, mask); 00273 } |
|
Register a set of .
Definition at line 631 of file Select_Reactor_T.cpp. References ACE_Reactor_Mask, and ACE_TRACE.
00634 { 00635 ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i"); 00636 ACE_HANDLE h; 00637 00638 ACE_Handle_Set_Iterator handle_iter (handles); 00639 while ((h = handle_iter ()) != ACE_INVALID_HANDLE) 00640 if (this->register_handler_i (h, handler, mask) == -1) 00641 return -1; 00642 00643 return 0; 00644 } |
|
Do the work of actually binding the and with the . Definition at line 993 of file Select_Reactor_T.cpp. References ACE_Reactor_Mask, and ACE_TRACE.
00996 { 00997 ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i"); 00998 00999 // Insert the <handle, event_handle> tuple into the Handler 01000 // Repository. 01001 return this->handler_rep_.bind (handle, event_handler, mask); 01002 } |
|
Release the token lock when a Win32 structured exception occurs.
Definition at line 1388 of file Select_Reactor_T.cpp. References ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::token_.
01389 { 01390 #if defined (ACE_WIN32) 01391 this->token_.release (); 01392 return (int) EXCEPTION_CONTINUE_SEARCH; 01393 #else 01394 return 0; 01395 #endif /* ACE_WIN32 */ 01396 } |
|
Calls for every signal in .
Implements ACE_Reactor_Impl. Definition at line 673 of file Select_Reactor_T.cpp. References ACE_NSIG, and ACE_TRACE.
00674 { 00675 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); 00676 int result = 0; 00677 00678 #if (ACE_NSIG > 0) 00679 for (int s = 1; s < ACE_NSIG; ++s) 00680 if ((sigset.is_member (s) == 1) 00681 && this->signal_handler_->remove_handler (s) == -1) 00682 result = -1; 00683 #else /* ACE_NSIG <= 0 */ 00684 ACE_UNUSED_ARG (sigset); 00685 #endif /* ACE_NSIG <= 0 */ 00686 00687 return result; 00688 } |
|
Remove the ACE_Event_Handler currently associated with signum. 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. Definition at line 109 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Sig_Handler::remove_handler().
00113 { 00114 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); 00115 return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey); 00116 } |
|
Removes all the bindings for handles in the bind of . If there are no more bindings for any of these handlers then they are removed from the Select_Reactor. Implements ACE_Reactor_Impl. Definition at line 319 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00321 { 00322 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); 00323 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00324 return this->remove_handler_i (handles, mask); 00325 } |
|
Removes the bind of whose handle is from the Select_Reactor. If there are no more bindings for this then it is removed from the Select_Reactor. Implements ACE_Reactor_Impl. Definition at line 339 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00341 { 00342 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); 00343 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00344 return this->remove_handler_i (handle, mask); 00345 } |
|
Removes the binding of from the Select_Reactor. If there are no more bindings for this 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. Definition at line 329 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_Reactor_Mask, and ACE_TRACE.
00331 { 00332 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); 00333 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00334 return this->remove_handler_i (handler->get_handle (), mask); 00335 } |
|
Remove a set of .
Definition at line 614 of file Select_Reactor_T.cpp. References ACE_Reactor_Mask, and ACE_TRACE.
00616 { 00617 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i"); 00618 ACE_HANDLE h; 00619 00620 ACE_Handle_Set_Iterator handle_iter (handles); 00621 00622 while ((h = handle_iter ()) != ACE_INVALID_HANDLE) 00623 if (this->remove_handler_i (h, mask) == -1) 00624 return -1; 00625 00626 return 0; 00627 } |
|
Do the work of actually unbinding the and with the . Definition at line 1006 of file Select_Reactor_T.cpp. References ACE_Reactor_Mask, and ACE_TRACE. Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::check_handles(), and ACE_TP_Reactor::post_process_socket_event().
01008 { 01009 ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i"); 01010 01011 // Unbind this handle. 01012 return this->handler_rep_.unbind (handle, mask); 01013 } |
|
Enqueue ourselves into the list of waiting threads at the appropriate point specified by . Implements ACE_Select_Reactor_Impl. Definition at line 193 of file Select_Reactor_T.cpp. References ACE_TRACE, ACE_Select_Reactor_Impl::supress_notify_renew(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::token_.
00194 { 00195 ACE_TRACE ("ACE_Select_Reactor_T::renew"); 00196 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) 00197 if (this->supress_notify_renew () == 0) 00198 this->token_.renew (this->requeue_position_); 00199 #endif /* defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) */ 00200 } |
|
Get position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a callback. Implements ACE_Reactor_Impl. Definition at line 167 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, and ACE_TRACE.
00168 { 00169 ACE_TRACE ("ACE_Select_Reactor_T::requeue_position"); 00170 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00171 return this->requeue_position_; 00172 } |
|
Set position that the main ACE_Select_Reactor thread is requeued in the list of waiters during a callback. Implements ACE_Reactor_Impl. Definition at line 153 of file Select_Reactor_T.cpp. References ACE_GUARD, and ACE_TRACE.
00154 { 00155 ACE_TRACE ("ACE_Select_Reactor_T::requeue_position"); 00156 ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_)); 00157 #if defined (ACE_WIN32) 00158 ACE_UNUSED_ARG (rp); 00159 // Must always requeue ourselves "next" on Win32. 00160 this->requeue_position_ = 0; 00161 #else 00162 this->requeue_position_ = rp; 00163 #endif /* ACE_WIN32 */ 00164 } |
|
Resets the interval of the timer represented by to , which is specified in relative time to the current . If 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. Definition at line 742 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ESHUTDOWN.
00744 { 00745 ACE_TRACE ("ACE_Select_Reactor_T::reset_timer_interval"); 00746 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00747 00748 if (0 != this->timer_queue_) 00749 return this->timer_queue_->reset_interval (timer_id, interval); 00750 00751 errno = ESHUTDOWN; 00752 return -1; 00753 } |
|
Set a new value for restart and return the original value.
Implements ACE_Reactor_Impl. Definition at line 144 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN.
00145 { 00146 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00147 int const current_value = this->restart_; 00148 this->restart_ = r; 00149 return current_value; 00150 } |
|
Get the existing restart value.
Implements ACE_Reactor_Impl. Definition at line 137 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN.
00138 { 00139 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00140 return this->restart_; 00141 } |
|
Resume all in handle set.
Implements ACE_Reactor_Impl. Definition at line 21 of file Select_Reactor_T.inl. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_i().
00022 { 00023 ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); 00024 ACE_Handle_Set_Iterator handle_iter (handles); 00025 ACE_HANDLE h; 00026 00027 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00028 00029 while ((h = handle_iter ()) != ACE_INVALID_HANDLE) 00030 if (this->resume_i (h) == -1) 00031 return -1; 00032 00033 return 0; 00034 } |
|
Resume a temporarily suspended associated with . Implements ACE_Reactor_Impl. Definition at line 218 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_i().
|
|
Resume a temporarily suspend associated with . Implements ACE_Reactor_Impl. Definition at line 13 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Event_Handler::get_handle().
00014 { 00015 ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); 00016 return this->resume_handler (h->get_handle ()); 00017 } |
|
Resume all the in the Select_Reactor.
Implements ACE_Reactor_Impl. Definition at line 250 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, ACE_Event_Handler::get_handle(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_i().
00251 { 00252 ACE_TRACE ("ACE_Select_Reactor_T::resume_handlers"); 00253 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00254 00255 ACE_Event_Handler *eh = 0; 00256 00257 for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_); 00258 iter.next (eh) != 0; 00259 iter.advance ()) 00260 this->resume_i (eh->get_handle ()); 00261 00262 return 0; 00263 } |
|
|
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.
Implements ACE_Reactor_Impl. Definition at line 721 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ESHUTDOWN.
00725 { 00726 ACE_TRACE ("ACE_Select_Reactor_T::schedule_timer"); 00727 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00728 00729 if (0 != this->timer_queue_) 00730 return this->timer_queue_->schedule 00731 (handler, 00732 arg, 00733 timer_queue_->gettimeofday () + delay_time, 00734 interval); 00735 00736 errno = ESHUTDOWN; 00737 return -1; 00738 } |
|
ADD the dispatch MASK "bit" bound with the and the .
Implements ACE_Reactor_Impl. Definition at line 169 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops().
|
|
ADD the dispatch MASK "bit" bound with the and the .
Implements ACE_Reactor_Impl. Definition at line 153 of file Select_Reactor_T.inl. References ACE_Reactor_Mask, ACE_TRACE, ACE_Event_Handler::get_handle(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::mask_ops().
00155 { 00156 ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup"); 00157 return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); 00158 } |
|
Use a user specified signal handler instead.
Implements ACE_Reactor_Impl. Definition at line 450 of file Select_Reactor_T.cpp.
00451 { 00452 if (this->delete_signal_handler_) 00453 delete this->signal_handler_; 00454 this->signal_handler_ = signal_handler; 00455 this->delete_signal_handler_ = false; 00456 return 0; 00457 } |
|
Returns the current size of the Reactor's internal descriptor table. Implements ACE_Reactor_Impl. Definition at line 231 of file Select_Reactor_T.inl. References ACE_Select_Reactor_Handler_Repository::size().
00232 { 00233 return this->handler_rep_.size (); 00234 } |
|
Suspend all in handle set temporarily.
Implements ACE_Reactor_Impl. Definition at line 46 of file Select_Reactor_T.inl. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_i().
00047 { 00048 ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); 00049 ACE_Handle_Set_Iterator handle_iter (handles); 00050 ACE_HANDLE h; 00051 00052 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00053 00054 while ((h = handle_iter ()) != ACE_INVALID_HANDLE) 00055 if (this->suspend_i (h) == -1) 00056 return -1; 00057 00058 return 0; 00059 } |
|
Temporarily suspend the associated with .
Implements ACE_Reactor_Impl. Definition at line 226 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_i().
|
|
Temporarily suspend the associated with .
Implements ACE_Reactor_Impl. Definition at line 38 of file Select_Reactor_T.inl. References ACE_TRACE, and ACE_Event_Handler::get_handle().
00039 { 00040 ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); 00041 return this->suspend_handler (h->get_handle ()); 00042 } |
|
Suspend all the in the Select_Reactor.
Implements ACE_Reactor_Impl. Definition at line 234 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, ACE_TRACE, ACE_Event_Handler::get_handle(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_i().
00235 { 00236 ACE_TRACE ("ACE_Select_Reactor_T::suspend_handlers"); 00237 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); 00238 00239 ACE_Event_Handler *eh = 0; 00240 00241 for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_); 00242 iter.next (eh) != 0; 00243 iter.advance ()) 00244 this->suspend_i (eh->get_handle ()); 00245 00246 return 0; 00247 } |
|
Suspend the associated with .
Definition at line 945 of file Select_Reactor_T.cpp. References ACE_TRACE, ACE_Select_Reactor_Impl::clear_dispatch_mask(), ACE_Handle_Set::clr_bit(), ACE_Select_Reactor_Handle_Set::ex_mask_, ACE_Select_Reactor_Handler_Repository::find(), ACE_Handle_Set::is_set(), ACE_Select_Reactor_Handle_Set::rd_mask_, ACE_Handle_Set::set_bit(), and ACE_Select_Reactor_Handle_Set::wr_mask_. Referenced by ACE_TP_Reactor::handle_socket_events(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handler(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handlers().
00946 { 00947 ACE_TRACE ("ACE_Select_Reactor_T::suspend_i"); 00948 if (this->handler_rep_.find (handle) == 0) 00949 return -1; 00950 00951 if (this->wait_set_.rd_mask_.is_set (handle)) 00952 { 00953 this->suspend_set_.rd_mask_.set_bit (handle); 00954 this->wait_set_.rd_mask_.clr_bit (handle); 00955 } 00956 if (this->wait_set_.wr_mask_.is_set (handle)) 00957 { 00958 this->suspend_set_.wr_mask_.set_bit (handle); 00959 this->wait_set_.wr_mask_.clr_bit (handle); 00960 } 00961 if (this->wait_set_.ex_mask_.is_set (handle)) 00962 { 00963 this->suspend_set_.ex_mask_.set_bit (handle); 00964 this->wait_set_.ex_mask_.clr_bit (handle); 00965 } 00966 00967 // Kobi: we need to remove that handle from the 00968 // dispatch set as well. We use that function with all the relevant 00969 // masks - rd/wr/ex - all the mask. it is completely suspended 00970 this->clear_dispatch_mask (handle, ACE_Event_Handler::RWE_MASK); 00971 return 0; 00972 } |
|
Return the current ACE_Timer_Queue.
Implements ACE_Reactor_Impl. Definition at line 460 of file Select_Reactor_T.cpp.
00461 { 00462 return this->timer_queue_; 00463 } |
|
Set a user-specified timer queue.
Implements ACE_Reactor_Impl. Definition at line 467 of file Select_Reactor_T.cpp. References ACE_Timer_Queue.
00468 { 00469 if (this->delete_timer_queue_) 00470 delete this->timer_queue_; 00471 this->timer_queue_ = tq; 00472 this->delete_timer_queue_ = false; 00473 return 0; 00474 } |
|
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 120 of file Select_Reactor_T.inl.
00121 { 00122 // Since the Select_Reactor does not do any event associations, this 00123 // function always return 0. 00124 return 0; 00125 } |
|
Wait for events to occur.
Definition at line 1071 of file Select_Reactor_T.cpp. References ACE_TRACE, and ACE_OS::select(). Referenced by ACE_TP_Reactor::get_event_for_dispatching().
01073 { 01074 ACE_TRACE ("ACE_Select_Reactor_T::wait_for_multiple_events"); 01075 ACE_Time_Value timer_buf (0); 01076 ACE_Time_Value *this_timeout; 01077 01078 int number_of_active_handles = this->any_ready (dispatch_set); 01079 01080 // If there are any bits enabled in the <ready_set_> then we'll 01081 // handle those first, otherwise we'll block in <select>. 01082 01083 if (number_of_active_handles == 0) 01084 { 01085 do 01086 { 01087 if (this->timer_queue_ == 0) 01088 return 0; 01089 01090 this_timeout = 01091 this->timer_queue_->calculate_timeout (max_wait_time, 01092 &timer_buf); 01093 #ifdef ACE_WIN32 01094 // This arg is ignored on Windows and causes pointer 01095 // truncation warnings on 64-bit compiles. 01096 int const width = 0; 01097 #else 01098 int const width = this->handler_rep_.max_handlep1 (); 01099 #endif /* ACE_WIN32 */ 01100 01101 dispatch_set.rd_mask_ = this->wait_set_.rd_mask_; 01102 dispatch_set.wr_mask_ = this->wait_set_.wr_mask_; 01103 dispatch_set.ex_mask_ = this->wait_set_.ex_mask_; 01104 number_of_active_handles = ACE_OS::select (width, 01105 dispatch_set.rd_mask_, 01106 dispatch_set.wr_mask_, 01107 dispatch_set.ex_mask_, 01108 this_timeout); 01109 } 01110 while (number_of_active_handles == -1 && this->handle_error () > 0); 01111 01112 if (number_of_active_handles > 0) 01113 { 01114 #if !defined (ACE_WIN32) 01115 // Resynchronize the fd_sets so their "max" is set properly. 01116 dispatch_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); 01117 dispatch_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); 01118 dispatch_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); 01119 #endif /* ACE_WIN32 */ 01120 } 01121 else if (number_of_active_handles == -1) 01122 { 01123 // Normally, select() will reset the bits in dispatch_set 01124 // so that only those filed descriptors that are ready will 01125 // have bits set. However, when an error occurs, the bit 01126 // set remains as it was when the select call was first made. 01127 // Thus, we now have a dispatch_set that has every file 01128 // descriptor that was originally waited for, which is not 01129 // correct. We must clear all the bit sets because we 01130 // have no idea if any of the file descriptors is ready. 01131 // 01132 // NOTE: We dont have a test case to reproduce this 01133 // problem. But pleae dont ignore this and remove it off. 01134 dispatch_set.rd_mask_.reset (); 01135 dispatch_set.wr_mask_.reset (); 01136 dispatch_set.ex_mask_.reset (); 01137 } 01138 } 01139 01140 // Return the number of events to dispatch. 01141 return number_of_active_handles; 01142 } |
|
Wake up all threads in waiting in the event loop.
Implements ACE_Reactor_Impl. Definition at line 192 of file Select_Reactor_T.inl. References ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::notify(). Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivate().
00193 { 00194 // Send a notification, but don't block if there's no one to receive 00195 // it. 00196 this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero); 00197 } |
|
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 1017 of file Select_Reactor_T.cpp. References ACE_GUARD_RETURN, 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_.
01018 { 01019 ACE_TRACE ("ACE_Select_Reactor_T::work_pending"); 01020 01021 ACE_Time_Value mwt (max_wait_time); 01022 ACE_MT (ACE_Countdown_Time countdown (&mwt)); 01023 01024 ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, 01025 ace_mon, 01026 this->token_, 01027 -1)); 01028 01029 if (this->deactivated_) 01030 return 0; 01031 01032 // Update the countdown to reflect time waiting for the mutex. 01033 ACE_MT (countdown.update ()); 01034 01035 ACE_Time_Value timer_buf (0); 01036 ACE_Time_Value *this_timeout = 01037 this->timer_queue_->calculate_timeout (&mwt, &timer_buf); 01038 01039 // Check if we have timers to fire. 01040 bool const timers_pending = 01041 (this_timeout != 0 && *this_timeout != mwt ? true : false); 01042 01043 #ifdef ACE_WIN32 01044 // This arg is ignored on Windows and causes pointer truncation 01045 // warnings on 64-bit compiles. 01046 int const width = 0; 01047 #else 01048 int const width = this->handler_rep_.max_handlep1 (); 01049 #endif /* ACE_WIN32 */ 01050 01051 ACE_Select_Reactor_Handle_Set fd_set; 01052 fd_set.rd_mask_ = this->wait_set_.rd_mask_; 01053 fd_set.wr_mask_ = this->wait_set_.wr_mask_; 01054 fd_set.ex_mask_ = this->wait_set_.ex_mask_; 01055 01056 int const nfds = ACE_OS::select (width, 01057 fd_set.rd_mask_, 01058 fd_set.wr_mask_, 01059 fd_set.ex_mask_, 01060 this_timeout); 01061 01062 // If timers are pending, override any timeout from the select() 01063 // call. 01064 return (nfds == 0 && timers_pending ? 1 : nfds); 01065 } |
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_Reactor_Impl. Reimplemented in ACE_Priority_Reactor, and ACE_TP_Reactor. Definition at line 545 of file Select_Reactor_T.h. |
|
This flag is used to keep track of whether we are actively handling events or not. Definition at line 695 of file Select_Reactor_T.h. Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivate(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::deactivated(). |
|
Adapter used to return internal lock to outside world.
Definition at line 685 of file Select_Reactor_T.h. Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::lock(). |
|
Synchronization token for the MT_SAFE ACE_Select_Reactor.
Definition at line 682 of file Select_Reactor_T.h. Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::dump(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::release_token(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::renew(). |