summaryrefslogtreecommitdiff
path: root/ACE/ace/Select_Reactor_T.cpp
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-08-08 14:10:47 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-08-08 14:10:47 +0000
commitf1ffa373494371059602bc781fa11b4a38dd2069 (patch)
treead38f66e69c242ecb6b3f4fc6bf2d05dc8090dce /ACE/ace/Select_Reactor_T.cpp
parent740c3adbb3ff18fe4f7d6f582f7bc341ea2cf544 (diff)
downloadATCD-f1ffa373494371059602bc781fa11b4a38dd2069.tar.gz
Tue Aug 8 14:00:06 UTC 2006 Carlos O'Ryan <coryan@atdesk.com> (merge 73857:73859)
Diffstat (limited to 'ACE/ace/Select_Reactor_T.cpp')
-rw-r--r--ACE/ace/Select_Reactor_T.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp
index 6619459c449..bf0bdbc36cb 100644
--- a/ACE/ace/Select_Reactor_T.cpp
+++ b/ACE/ace/Select_Reactor_T.cpp
@@ -1284,6 +1284,13 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dispatch
do
{
+ // We expect that the loop will decrease the number of active
+ // handles in each iteration. If it does not, then something is
+ // inconsistent in the state of the Reactor and we should avoid
+ // the loop. Please read the comments on bug 2540 for more
+ // details.
+ int initial_handle_count = active_handle_count;
+
// Note that we keep track of changes to our state. If any of
// the dispatch_*() methods below return -1 it means that the
// <wait_set_> state has changed as the result of an
@@ -1358,11 +1365,10 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dispatch
// if state changed, we need to re-eval active_handle_count,
// so we will not end with an endless loop
- if (this->state_changed_)
+ if (initial_handle_count == active_handle_count
+ || this->state_changed_)
{
- active_handle_count = this->dispatch_set_.rd_mask_.num_set ()
- + this->dispatch_set_.wr_mask_.num_set ()
- + this->dispatch_set_.ex_mask_.num_set ();
+ active_handle_count = this->any_ready (dispatch_set);
}
}
while (active_handle_count > 0);