00001 // LF_Event.cpp,v 1.10 2006/03/10 07:19:05 jtc Exp 00002 00003 #include "tao/LF_Event.h" 00004 #include "tao/LF_Follower.h" 00005 #include "tao/Leader_Follower.h" 00006 #include "ace/Guard_T.h" 00007 00008 #if !defined (__ACE_INLINE__) 00009 # include "tao/LF_Event.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 ACE_RCSID (tao, 00013 LF_Event, 00014 "LF_Event.cpp,v 1.10 2006/03/10 07:19:05 jtc Exp") 00015 00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 TAO_LF_Event::TAO_LF_Event (void) 00019 : state_ (TAO_LF_Event::LFS_IDLE) 00020 , follower_ (0) 00021 { 00022 } 00023 00024 TAO_LF_Event::~TAO_LF_Event (void) 00025 { 00026 } 00027 00028 void 00029 TAO_LF_Event::state_changed (int new_state, 00030 TAO_Leader_Follower &lf) 00031 { 00032 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ()); 00033 00034 if (this->is_state_final () == 0) 00035 { 00036 this->state_changed_i (new_state); 00037 00038 /// Sort of double-checked optimization.. 00039 if (this->follower_ != 0) 00040 this->follower_->signal (); 00041 } 00042 } 00043 00044 void 00045 TAO_LF_Event::set_state (int new_state) 00046 { 00047 this->state_ = new_state; 00048 } 00049 00050 TAO_END_VERSIONED_NAMESPACE_DECL