diff options
author | Steve Huston <shuston@riverace.com> | 2000-08-25 20:31:10 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2000-08-25 20:31:10 +0000 |
commit | 03c590114bedbc13ec7c65f9b8df751da0484634 (patch) | |
tree | 2c1c27cc9fa4b53ffae24d1a4ec7c06c28d51549 | |
parent | 65749e70ab71c2d7c20d93a1178fc8a2910f13a3 (diff) | |
download | ATCD-03c590114bedbc13ec7c65f9b8df751da0484634.tar.gz |
ChangeLogTag:Fri Aug 25 16:29:51 2000 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ace/TP_Reactor.cpp | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp index b23e0282560..2ace909a079 100644 --- a/ace/TP_Reactor.cpp +++ b/ace/TP_Reactor.cpp @@ -109,18 +109,7 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // *not* dispatch any I/O handlers. It will dispatch signals, // timeouts, and notifications. ACE_EH_Dispatch_Info dispatch_info; - ACE_SEH_TRY - { - result = this->dispatch_i (max_wait_time, dispatch_info); - } - - ACE_SEH_EXCEPT (this->release_token ()) - { - // As it stands now, we catch and then rethrow all Win32 - // structured exceptions so that we can make sure to release the - // <token_> lock correctly. - } - + result = this->dispatch_i (max_wait_time, dispatch_info); if (result == -1) { ACE_MT (this->token_.release ()); @@ -225,57 +214,68 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, // existing notion of handles in <dispatch_set_> may no longer be // correct. - // First check for interrupts. - if (active_handle_count == -1) - { - // Bail out -- we got here since <select> was interrupted. - if (ACE_Sig_Handler::sig_pending () != 0) - { - ACE_Sig_Handler::sig_pending (0); + // ACE_SEH_TRY + //{ + + // First check for interrupts. + if (active_handle_count == -1) + { + // Bail out -- we got here since <select> was interrupted. + if (ACE_Sig_Handler::sig_pending () != 0) + { + ACE_Sig_Handler::sig_pending (0); #if 0 - // Not sure if this should be done in the TP_Reactor - // case... leave it out for now. -Steve Huston 22-Aug-00 + // Not sure if this should be done in the TP_Reactor + // case... leave it out for now. -Steve Huston 22-Aug-00 - // If any HANDLES in the <ready_set_> are activated as a - // result of signals they should be dispatched since - // they may be time critical... - active_handle_count = this->any_ready (dispatch_set); + // If any HANDLES in the <ready_set_> are activated as a + // result of signals they should be dispatched since + // they may be time critical... + active_handle_count = this->any_ready (dispatch_set); #else - active_handle_count = 0; + active_handle_count = 0; #endif - // Record the fact that the Reactor has dispatched a - // handle_signal() method. We need this to return the - // appropriate count below. - signal_occurred = 1; - } - else - return -1; - } - - // Handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of - // dispatching should be a strategy... - this->dispatch_timer_handlers (handlers_dispatched); - - // If either the state has changed as a result of timer - // expiry, or there are no handles ready for dispatching, - // all done for now. - if (this->state_changed_ || active_handle_count == 0) - return signal_occurred + handlers_dispatched; - - // Next dispatch the notification handlers (if there are any to - // dispatch). These are required to handle multi-threads that - // are trying to update the <Reactor>. - - this->dispatch_notification_handlers (this->ready_set_, - active_handle_count, - handlers_dispatched); - - // If one of those changed the state, return. - if (this->state_changed_ || active_handle_count == 0) - return signal_occurred + handlers_dispatched; + // Record the fact that the Reactor has dispatched a + // handle_signal() method. We need this to return the + // appropriate count below. + signal_occurred = 1; + } + else + return -1; + } + + // Handle timers early since they may have higher latency + // constraints than I/O handlers. Ideally, the order of + // dispatching should be a strategy... + this->dispatch_timer_handlers (handlers_dispatched); + + // If either the state has changed as a result of timer + // expiry, or there are no handles ready for dispatching, + // all done for now. + if (this->state_changed_ || active_handle_count == 0) + return signal_occurred + handlers_dispatched; + + // Next dispatch the notification handlers (if there are any to + // dispatch). These are required to handle multi-threads that + // are trying to update the <Reactor>. + + this->dispatch_notification_handlers (this->ready_set_, + active_handle_count, + handlers_dispatched); + + // If one of those changed the state, return. + if (this->state_changed_ || active_handle_count == 0) + return signal_occurred + handlers_dispatched; + // } + + // ACE_SEH_EXCEPT (this->release_token ()) + // { + // As it stands now, we catch and then rethrow all Win32 + // structured exceptions so that we can make sure to release the + // <token_> lock correctly. + // } // Check for dispatch in write, except, read. Only catch one. int found_io = 0; @@ -286,16 +286,16 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, while ((handle = handle_iter ()) != ACE_INVALID_HANDLE && !found_io) { - if (this->is_suspended_i (handle)) - continue; - - // Remember this info - event.set (handle, - this->handler_rep_.find (handle), - ACE_Event_Handler::WRITE_MASK, - &ACE_Event_Handler::handle_output); - this->ready_set_.wr_mask_.clr_bit (handle); - found_io = 1; + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::WRITE_MASK, + &ACE_Event_Handler::handle_output); + this->ready_set_.wr_mask_.clr_bit (handle); + found_io = 1; } } @@ -304,18 +304,18 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, ACE_Handle_Set_Iterator handle_iter (this->ready_set_.ex_mask_); while ((handle = handle_iter ()) != ACE_INVALID_HANDLE && !found_io) - { - if (this->is_suspended_i (handle)) - continue; - - // Remember this info - event.set (handle, - this->handler_rep_.find (handle), - ACE_Event_Handler::EXCEPT_MASK, - &ACE_Event_Handler::handle_exception); - this->ready_set_.ex_mask_.clr_bit (handle); - found_io = 1; - } + { + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::EXCEPT_MASK, + &ACE_Event_Handler::handle_exception); + this->ready_set_.ex_mask_.clr_bit (handle); + found_io = 1; + } } if (!found_io) @@ -323,18 +323,18 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, ACE_Handle_Set_Iterator handle_iter (this->ready_set_.rd_mask_); while ((handle = handle_iter ()) != ACE_INVALID_HANDLE && !found_io) - { - if (this->is_suspended_i (handle)) - continue; - - // Remember this info - event.set (handle, - this->handler_rep_.find (handle), - ACE_Event_Handler::READ_MASK, - &ACE_Event_Handler::handle_input); - this->ready_set_.rd_mask_.clr_bit (handle); - found_io = 1; - } + { + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::READ_MASK, + &ACE_Event_Handler::handle_input); + this->ready_set_.rd_mask_.clr_bit (handle); + found_io = 1; + } } result = signal_occurred + handlers_dispatched; |