summaryrefslogtreecommitdiff
path: root/TAO/tao/Leader_Follower.cpp
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-23 19:19:37 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-23 19:19:37 +0000
commit25538be12f1a25c1e44f8867060109c4fa28f568 (patch)
tree7026cdb0f063a9287b7f93f640cc4d302354d00b /TAO/tao/Leader_Follower.cpp
parentea905c6567ef6f72637b9eb4e0ef2b045276c89a (diff)
downloadATCD-25538be12f1a25c1e44f8867060109c4fa28f568.tar.gz
ChangeLogTag:Tue Jan 23 11:15:59 2001 Carlos O'Ryan <coryan@uci.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 8f116792de0..379c0d6fd4e 100644
--- a/TAO/tao/Leader_Follower.cpp
+++ b/TAO/tao/Leader_Follower.cpp
@@ -109,6 +109,51 @@ TAO_Leader_Follower::reactor (void)
return this->reactor_;
}
+void
+TAO_Leader_Follower::set_client_thread (void)
+{
+ // If we were a leader thread or an event loop thread, give up
+ // leadership.
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ if (tss->event_loop_thread_ ||
+ tss->client_leader_thread_)
+ {
+ --this->leaders_;
+ }
+
+ if (this->clients_ == 0 &&
+ this->orb_core_->has_shutdown ())
+ {
+ // The ORB has shutdown and we are the first client after
+ // that. This means that the reactor is disabled, we must
+ // re-enable it if we want to receive any replys...
+ this->orb_core_->reactor ()->reset_reactor_event_loop ();
+ }
+ this->clients_++;
+}
+
+void
+TAO_Leader_Follower::reset_client_thread (void)
+{
+ // If we were a leader thread or an event loop thread, take back
+ // leadership.
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ if (tss->event_loop_thread_ ||
+ tss->client_leader_thread_)
+ {
+ ++this->leaders_;
+ }
+
+ this->clients_--;
+ if (this->clients_ == 0 && this->orb_core_->has_shutdown ())
+ {
+ // The ORB has shutdown and we are the last client thread, we
+ // must stop the reactor to ensure that any server threads go
+ // away.
+ this->orb_core_->reactor ()->end_reactor_event_loop ();
+ }
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Node<ACE_SYNCH_CONDITION*>;