diff options
Diffstat (limited to 'TAO/tao/Leader_Follower.i')
-rw-r--r-- | TAO/tao/Leader_Follower.i | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/TAO/tao/Leader_Follower.i b/TAO/tao/Leader_Follower.i index 9e0f1eeff99..6bddae3f4be 100644 --- a/TAO/tao/Leader_Follower.i +++ b/TAO/tao/Leader_Follower.i @@ -23,15 +23,9 @@ TAO_Leader_Follower::get_tss_resources (void) const } ACE_INLINE int -TAO_Leader_Follower::TAO_Follower_Queue::is_empty (void) const -{ - return this->head_ == 0; -} - -ACE_INLINE int TAO_Leader_Follower::follower_available (void) const { - return !this->follower_set_.is_empty (); + return !this->follower_set_.empty (); } ACE_INLINE int @@ -45,9 +39,7 @@ TAO_Leader_Follower::elect_new_leader (void) } else if (this->follower_available ()) { - TAO_SYNCH_CONDITION* condition_ptr = this->get_next_follower (); - if (condition_ptr == 0 || condition_ptr->signal () == -1) - return -1; + return this->elect_new_leader_i (); } } return 0; @@ -161,16 +153,16 @@ TAO_Leader_Follower::is_client_leader_thread (void) const return tss->client_leader_thread_ != 0; } -ACE_INLINE int -TAO_Leader_Follower::add_follower (TAO_Follower_Node *follower_node) +ACE_INLINE void +TAO_Leader_Follower::add_follower (TAO_LF_Follower *follower) { - return this->follower_set_.insert (follower_node); + this->follower_set_.push_back (follower); } -ACE_INLINE int -TAO_Leader_Follower::remove_follower (TAO_Follower_Node *follower_node) +ACE_INLINE void +TAO_Leader_Follower::remove_follower (TAO_LF_Follower *follower) { - return this->follower_set_.remove (follower_node); + this->follower_set_.remove (follower); } ACE_INLINE ACE_Reverse_Lock<TAO_SYNCH_MUTEX> & @@ -185,7 +177,7 @@ TAO_Leader_Follower::has_clients (void) const return this->clients_; } - +// **************************************************************** ACE_INLINE TAO_LF_Client_Thread_Helper::TAO_LF_Client_Thread_Helper (TAO_Leader_Follower &leader_follower) @@ -212,30 +204,3 @@ TAO_LF_Client_Leader_Thread_Helper::~TAO_LF_Client_Leader_Thread_Helper (void) { this->leader_follower_.reset_client_leader_thread (); } - -ACE_INLINE int -TAO_LF_Event_Loop_Thread_Helper::set_event_loop_thread (ACE_Time_Value *max_wait_time) -{ - int result = this->lf_strategy_.set_event_loop_thread (max_wait_time, leader_follower_); - - if (result == 0) - this->call_reset_ = 1; - - return result; -} - -ACE_INLINE -TAO_LF_Event_Loop_Thread_Helper::TAO_LF_Event_Loop_Thread_Helper (TAO_Leader_Follower &leader_follower, - TAO_LF_Strategy &lf_strategy) - : leader_follower_ (leader_follower), - lf_strategy_ (lf_strategy), - call_reset_ (0) -{ -} - -ACE_INLINE -TAO_LF_Event_Loop_Thread_Helper::~TAO_LF_Event_Loop_Thread_Helper (void) -{ - this->lf_strategy_.reset_event_loop_thread_and_elect_new_leader (this->call_reset_, - this->leader_follower_); -} |