summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2000-08-29 16:27:20 +0000
committerSteve Huston <shuston@riverace.com>2000-08-29 16:27:20 +0000
commit94bb74b16e9d8e970903a05a003e76981a71dc74 (patch)
treee41331cb28409d6a02156e1c5d3295bb42e2add6
parent84080576fa7dba903fec7a370d00f62bb274d033 (diff)
downloadATCD-94bb74b16e9d8e970903a05a003e76981a71dc74.tar.gz
ChangeLogTag:Tue Aug 29 12:23:41 2000 Steve Huston <shuston@riverace.com>
-rw-r--r--ace/TP_Reactor.cpp114
-rw-r--r--ace/TP_Reactor.h5
2 files changed, 67 insertions, 52 deletions
diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp
index 2ace909a079..0c499229e76 100644
--- a/ace/TP_Reactor.cpp
+++ b/ace/TP_Reactor.cpp
@@ -109,7 +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;
- result = this->dispatch_i (max_wait_time, dispatch_info);
+ result = this->dispatch_i_protected (max_wait_time, dispatch_info);
if (result == -1)
{
ACE_MT (this->token_.release ());
@@ -214,68 +214,57 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time,
// existing notion of handles in <dispatch_set_> may no longer be
// correct.
- // 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);
+ // 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);
+ // 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;
+ }
- // 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;
+ // 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);
- // 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>.
+ // 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;
- this->dispatch_notification_handlers (this->ready_set_,
- active_handle_count,
- 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>.
- // If one of those changed the state, return.
- if (this->state_changed_ || active_handle_count == 0)
- return signal_occurred + handlers_dispatched;
- // }
+ this->dispatch_notification_handlers (this->ready_set_,
+ active_handle_count,
+ 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.
- // }
+ // If one of those changed the state, return.
+ if (this->state_changed_ || active_handle_count == 0)
+ return signal_occurred + handlers_dispatched;
// Check for dispatch in write, except, read. Only catch one.
int found_io = 0;
@@ -342,6 +331,27 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time,
return result;
}
+int
+ACE_TP_Reactor::dispatch_i_protected (ACE_Time_Value *max_wait_time,
+ ACE_EH_Dispatch_Info &event)
+{
+ int result;
+
+ ACE_SEH_TRY
+ {
+ result = this->dispatch_i (max_wait_time, event);
+ }
+ 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.
+ }
+
+ return result;
+
+}
+
// Dispatches a single event handler
int
diff --git a/ace/TP_Reactor.h b/ace/TP_Reactor.h
index ce61d5c4548..ab1dcf2078c 100644
--- a/ace/TP_Reactor.h
+++ b/ace/TP_Reactor.h
@@ -186,6 +186,11 @@ protected:
// in the timer queue expiry functions and the notification class to
// do this without some significant redesign.
+ int dispatch_i_protected (ACE_Time_Value *max_wait_time,
+ ACE_EH_Dispatch_Info &event);
+ // Only really does anything for Win32. Wraps a call to dispatch_i in an
+ // ACE_SEH_TRY block.
+
virtual void notify_handle (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Handle_Set &,