00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file LF_Follower.h 00006 * 00007 * $Id: LF_Follower.h 74014 2006-08-14 13:52:22Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan <coryan@uci.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_LF_FOLLOWER_H 00014 #define TAO_LF_FOLLOWER_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include /**/ "tao/TAO_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include /**/ "tao/Versioned_Namespace.h" 00025 00026 #include "ace/Condition_Thread_Mutex.h" 00027 #include "ace/Synch_Traits.h" 00028 #include "ace/Intrusive_List_Node.h" 00029 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 class TAO_Leader_Follower; 00034 00035 /** 00036 * @class TAO_LF_Follower 00037 * 00038 * @brief Represent a thread blocked, as a follower, in the 00039 * Leader/Followers set. 00040 * 00041 * @todo Currently this class offers little abstraction, the follower 00042 * loop should be implemented by this class. 00043 * 00044 */ 00045 class TAO_Export TAO_LF_Follower 00046 : public ACE_Intrusive_List_Node<TAO_LF_Follower> 00047 { 00048 public: 00049 /// Constructor 00050 TAO_LF_Follower (TAO_Leader_Follower &leader_follower); 00051 00052 /// Destructor 00053 ~TAO_LF_Follower (void); 00054 00055 /// Access the leader follower that owns this follower 00056 TAO_Leader_Follower &leader_follower (void); 00057 00058 /// Wait until on the underlying condition variable 00059 int wait (ACE_Time_Value *tv); 00060 00061 /// Signal the underlying condition variable 00062 int signal (void); 00063 00064 private: 00065 /// The Leader/Follower set this Follower belongs to 00066 TAO_Leader_Follower &leader_follower_; 00067 00068 /// Condition variable used to 00069 ACE_SYNCH_CONDITION condition_; 00070 }; 00071 00072 TAO_END_VERSIONED_NAMESPACE_DECL 00073 00074 #if defined (__ACE_INLINE__) 00075 # include "tao/LF_Follower.inl" 00076 #endif /* __ACE_INLINE__ */ 00077 00078 #include /**/ "ace/post.h" 00079 00080 #endif /* TAO_LF_FOLLOWER_H */