Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / LF_Event.cpp
blobd8cf240ce1c73598f6b9fb99dc6788b0bbdae175
1 // -*- C++ -*-
2 #include "tao/LF_Event.h"
3 #include "tao/LF_Follower.h"
4 #include "tao/Leader_Follower.h"
5 #include "ace/Guard_T.h"
7 #if !defined (__ACE_INLINE__)
8 # include "tao/LF_Event.inl"
9 #endif /* __ACE_INLINE__ */
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_LF_Event::TAO_LF_Event ()
14 : state_ (TAO_LF_Event::LFS_IDLE)
15 , follower_ (nullptr)
19 TAO_LF_Event::~TAO_LF_Event ()
23 void
24 TAO_LF_Event::state_changed (LFS_STATE new_state, TAO_Leader_Follower &lf)
26 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ());
28 if (!this->is_state_final ())
30 this->state_changed_i (new_state);
32 /// Sort of double-checked optimization..
33 if (this->follower_ != nullptr)
34 this->follower_->signal ();
38 bool
39 TAO_LF_Event::keep_waiting (TAO_Leader_Follower &lf) const
41 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, lf.lock (), false);
43 return this->keep_waiting_i ();
46 bool
47 TAO_LF_Event::successful (TAO_Leader_Follower &lf) const
49 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, lf.lock (), false);
51 return this->successful_i ();
54 bool
55 TAO_LF_Event::error_detected (TAO_Leader_Follower &lf) const
57 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, lf.lock (), true);
59 return this->error_detected_i ();
62 void
63 TAO_LF_Event::set_state (LFS_STATE new_state)
65 this->state_ = new_state;
68 TAO_END_VERSIONED_NAMESPACE_DECL