TAO_LF_Follower Class Reference

Represent a thread blocked, as a follower, in the Leader/Followers set. More...

#include <LF_Follower.h>

Inheritance diagram for TAO_LF_Follower:

Inheritance graph
[legend]
Collaboration diagram for TAO_LF_Follower:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_LF_Follower (TAO_Leader_Follower &leader_follower)
 Constructor.
 ~TAO_LF_Follower (void)
 Destructor.
TAO_Leader_Followerleader_follower (void)
 Access the leader follower that owns this follower.
int wait (ACE_Time_Value *tv)
 Wait until on the underlying condition variable.
int signal (void)
 Signal the underlying condition variable.

Private Attributes

TAO_Leader_Followerleader_follower_
 The Leader/Follower set this Follower belongs to.
ACE_SYNCH_CONDITION condition_
 Condition variable used to.

Detailed Description

Represent a thread blocked, as a follower, in the Leader/Followers set.

Todo:
Currently this class offers little abstraction, the follower loop should be implemented by this class.

Definition at line 45 of file LF_Follower.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_LF_Follower::TAO_LF_Follower ( TAO_Leader_Follower leader_follower  ) 

Constructor.

Definition at line 16 of file LF_Follower.cpp.

00017   : leader_follower_ (leader_follower)
00018   , condition_ (leader_follower.lock ())
00019 {
00020 }

TAO_LF_Follower::~TAO_LF_Follower ( void   ) 

Destructor.

Definition at line 22 of file LF_Follower.cpp.

00023 {
00024 }


Member Function Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Leader_Follower & TAO_LF_Follower::leader_follower ( void   ) 

Access the leader follower that owns this follower.

Definition at line 8 of file LF_Follower.inl.

References leader_follower_.

00009 {
00010   return this->leader_follower_;
00011 }

int TAO_LF_Follower::signal ( void   ) 

Signal the underlying condition variable.

Definition at line 27 of file LF_Follower.cpp.

References condition_.

Referenced by TAO_Leader_Follower::elect_new_leader_i(), and TAO_LF_Event::state_changed().

00028 {
00029   // We *must* remove ourselves from the list of followers, otherwise
00030   // we could get signalled twice: to wake up as a follower and as the
00031   // next leader.
00032   // The follower may not be there if the reply is received while
00033   // the consumer is not yet waiting for it (i.e. it send the
00034   // request but has not blocked to receive the reply yet).
00035   // Ignore errors.
00036   (void) this->leader_follower_.remove_follower (this);
00037 
00038   return this->condition_.signal ();
00039 }

ACE_INLINE int TAO_LF_Follower::wait ( ACE_Time_Value tv  ) 

Wait until on the underlying condition variable.

Definition at line 14 of file LF_Follower.inl.

References condition_.

00015 {
00016   return this->condition_.wait (tv);
00017 }


Member Data Documentation

ACE_SYNCH_CONDITION TAO_LF_Follower::condition_ [private]

Condition variable used to.

Definition at line 69 of file LF_Follower.h.

Referenced by signal(), and wait().

TAO_Leader_Follower& TAO_LF_Follower::leader_follower_ [private]

The Leader/Follower set this Follower belongs to.

Definition at line 66 of file LF_Follower.h.

Referenced by leader_follower().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:35 2010 for TAO by  doxygen 1.4.7