diff options
author | bala <balanatarajan@users.noreply.github.com> | 2001-03-22 21:46:59 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2001-03-22 21:46:59 +0000 |
commit | 479aa77fb6bffc5a81f5f883c981d31126885063 (patch) | |
tree | 791af9124ef2a337129e549c4fcca736818d9462 /TAO/tao | |
parent | 79338cbb5e6cb1a546c3dc926a7fc6779cea02cf (diff) | |
download | ATCD-479aa77fb6bffc5a81f5f883c981d31126885063.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Leader_Follower.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/TAO/tao/Leader_Follower.h b/TAO/tao/Leader_Follower.h index 569133484fd..472ba426b1c 100644 --- a/TAO/tao/Leader_Follower.h +++ b/TAO/tao/Leader_Follower.h @@ -74,13 +74,23 @@ public: */ int elect_new_leader (void); + // Node structure for the queue + struct TAO_Follower_Node + { + TAO_Follower_Node (TAO_SYNCH_CONDITION *follower_ptr); + + TAO_SYNCH_CONDITION *follower; + + TAO_Follower_Node *next; + + }; /** * adds the a follower to the set of followers in the leader- * follower model * returns 0 on success, -1 on failure and 1 if the element is * already there. */ - int add_follower (TAO_SYNCH_CONDITION *follower_ptr); + int add_follower (TAO_Follower_Node* node); /// checks for the availablity of a follower /// returns 1 on available, 0 else @@ -88,7 +98,7 @@ public: /// removes a follower from the leader-follower set /// returns 0 on success, -1 on failure - int remove_follower (TAO_SYNCH_CONDITION *follower_ptr); + int remove_follower (TAO_Follower_Node* node); /// returns randomly a follower from the leader-follower set /// returns follower on success, else 0 @@ -104,6 +114,8 @@ public: /// Accesor to the reactor ACE_Reactor *reactor (void); + + private: /// Shortcut to obtain the TSS resources of the orb core. TAO_ORB_Core_TSS_Resources *get_tss_resources (void) const; @@ -128,7 +140,23 @@ private: /// do protect the access to the following three members ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock_; - ACE_Unbounded_Set<TAO_SYNCH_CONDITION *> follower_set_; + // Queue to store the followers + struct TAO_Follower_Queue + { + TAO_Follower_Queue (void); + + int is_empty (void) const; + + int remove (TAO_Follower_Node *); + + int insert (TAO_Follower_Node *); + + TAO_Follower_Node *head; + + TAO_Follower_Node *tail; + }; + + TAO_Follower_Queue follower_set_; // keep a set of followers around (protected) /** |