00001 // $Id: LF_Event.cpp 76687 2007-01-29 19:18:13Z johnnyw $ 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 "$Id: LF_Event.cpp 76687 2007-01-29 19:18:13Z johnnyw $") 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, TAO_Leader_Follower &lf) 00030 { 00031 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ()); 00032 00033 if (this->is_state_final () == 0) 00034 { 00035 this->state_changed_i (new_state); 00036 00037 /// Sort of double-checked optimization.. 00038 if (this->follower_ != 0) 00039 this->follower_->signal (); 00040 } 00041 } 00042 00043 void 00044 TAO_LF_Event::set_state (int new_state) 00045 { 00046 this->state_ = new_state; 00047 } 00048 00049 TAO_END_VERSIONED_NAMESPACE_DECL