summaryrefslogtreecommitdiff
path: root/TAO/tao/Leader_Follower.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-01-26 02:34:55 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-01-26 02:34:55 +0000
commit00814bd49c0a4ddac4f53924aca723a1f7aff590 (patch)
treecec94f491276648b74ffd67bed6670573a891a4a /TAO/tao/Leader_Follower.cpp
parent058614abbaf5b468773deedd5165036401f136f4 (diff)
downloadATCD-00814bd49c0a4ddac4f53924aca723a1f7aff590.tar.gz
Change:Tue Jan 25 20:33:28 2000 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Leader_Follower.cpp')
-rw-r--r--TAO/tao/Leader_Follower.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/TAO/tao/Leader_Follower.cpp b/TAO/tao/Leader_Follower.cpp
index a16dd4b3979..a16ccc369dc 100644
--- a/TAO/tao/Leader_Follower.cpp
+++ b/TAO/tao/Leader_Follower.cpp
@@ -44,6 +44,51 @@ TAO_Leader_Follower::get_next_follower (void)
return cond;
}
+int
+TAO_Leader_Follower::wait_for_client_leader_to_complete (ACE_Time_Value *max_wait_time)
+{
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ while (this->client_thread_is_leader_)
+ {
+ ACE_SYNCH_CONDITION *condition_variable =
+ this->orb_core_->leader_follower_condition_variable ();
+
+ if (this->add_follower (condition_variable) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot add to condition variable collection\n"),
+ -1);
+ }
+
+ if (max_wait_time == 0)
+ {
+ if (condition_variable->wait () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Condition variable wait failed\n"),
+ -1);
+ }
+ }
+ else
+ {
+ countdown.update ();
+ ACE_Time_Value tv = ACE_OS::gettimeofday ();
+ tv += *max_wait_time;
+ if (condition_variable->wait (&tv) == -1)
+ {
+ if (errno != ETIME)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Condition variable wait failed\n"),
+ -1);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
ACE_Reactor *
TAO_Leader_Follower::reactor (void)
{