summaryrefslogtreecommitdiff
path: root/TAO/tao/Wait_On_Leader_Follower.cpp
diff options
context:
space:
mode:
authorkitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-04 02:17:26 +0000
committerkitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-04 02:17:26 +0000
commit3d8cf24af747dd498d38487710cd21745c0a323d (patch)
treefa9c53e91dd4e5e8ae546dcca3f496825783818e /TAO/tao/Wait_On_Leader_Follower.cpp
parentcbddfaf010a7777011a0f2d26c1151f9ac6ddd04 (diff)
downloadATCD-3d8cf24af747dd498d38487710cd21745c0a323d.tar.gz
Tue Apr 3 21:14:36 2001 Krishnakumar B <kitty@cs.wustl.edu>
* tao/Leader_Follower.{i,h,cpp}: * tao/Wait_On_Leader_Follower.cpp: Fixed Bug Id 721 (this time for real).
Diffstat (limited to 'TAO/tao/Wait_On_Leader_Follower.cpp')
-rw-r--r--TAO/tao/Wait_On_Leader_Follower.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/TAO/tao/Wait_On_Leader_Follower.cpp b/TAO/tao/Wait_On_Leader_Follower.cpp
index 6355fde2f19..089c4b605f2 100644
--- a/TAO/tao/Wait_On_Leader_Follower.cpp
+++ b/TAO/tao/Wait_On_Leader_Follower.cpp
@@ -91,6 +91,9 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
this->transport_,
cond));
+ // Keep the entry on the stack
+ TAO_Leader_Follower::TAO_Follower_Node node(cond);
+
while (!reply_received &&
leader_follower.leader_available ())
{
@@ -118,7 +121,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
// lost.
//
- (void) leader_follower.add_follower (cond);
+ (void) leader_follower.add_follower (&node);
if (max_wait_time == 0)
{
@@ -145,10 +148,10 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
ACE_TEXT ("cond == 0 || cond->wait (tv) == -1\n"),
this->transport_));
- if (leader_follower.remove_follower (cond) == -1)
+ if (leader_follower.remove_follower (&node) == -1)
ACE_ERROR ((LM_ERROR,
"TAO (%P|%t) TAO_Wait_On_Leader_Follower::wait - "
- "remove_follower failed for <%x>\n", cond));
+ "remove_follower failed for <%x>\n", node.follower_));
return -1;
}
@@ -161,16 +164,16 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
// Cannot remove the follower here, we *must* remove it when
// we signal it so the same condition is not signalled for
// both wake up as a follower and as the next leader.
- if (leader_follower.remove_follower (cond) == -1)
+ if (leader_follower.remove_follower (&node) == -1)
ACE_ERROR ((LM_ERROR,
"TAO (%P|%t) TAO_Wait_On_Leader_Follower::wait - "
- "remove_follower failed for <%x>\n", cond));
+ "remove_follower failed for <%x>\n", node.follower));
#endif /* 0 */
if (TAO_debug_level >= 5)
ACE_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) - done (follower) "
- "on <%x>, reply_received %d\n",
+ ACE_TEXT ("TAO (%P|%t) - done (follower) "
+ "on <%x>, reply_received %d\n"),
this->transport_, reply_received));
// Now somebody woke us up to become a leader or to handle our
@@ -316,6 +319,10 @@ TAO_Wait_On_Leader_Follower::reply_dispatched (int &reply_received_flag,
reply_received_flag = 1;
+ // The following works as the node is assumed to be on the stack
+ // till the thread is alive.
+ TAO_Leader_Follower::TAO_Follower_Node node (condition);
+
// We *must* remove it when we signal it so the same condition
// is not signalled for both wake up as a follower and as the
// next leader.
@@ -323,7 +330,7 @@ TAO_Wait_On_Leader_Follower::reply_dispatched (int &reply_received_flag,
// the consumer is not yet waiting for it (i.e. it send the
// request but has not blocked to receive the reply yet).
// Ignore errors.
- (void) leader_follower.remove_follower (condition);
+ (void) leader_follower.remove_follower (&node);
if (condition->signal () == -1)
return -1;
@@ -346,7 +353,11 @@ TAO_Wait_On_Leader_Follower::connection_closed (int &reply_received_flag,
reply_received_flag = -1;
- (void) leader_follower.remove_follower (condition);
+ // The following works as the node is assumed to be on the stack
+ // till the thread is alive.
+ TAO_Leader_Follower::TAO_Follower_Node node(condition);
+
+ (void) leader_follower.remove_follower (&node);
(void) condition->signal ();
}