summaryrefslogtreecommitdiff
path: root/TAO/tao/LF_Event.cpp
blob: d3c5673b36882970012556c072d28761c149a084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- C++ -*-
// $Id$
#include "LF_Event.h"
#include "LF_Follower.h"
#include "Leader_Follower.h"
#include "ace/Guard_T.h"

#if !defined (__ACE_INLINE__)
# include "tao/LF_Event.inl"
#endif /* __ACE_INLINE__ */

ACE_RCSID (tao,
           LF_Event,
           "$Id$")

TAO_LF_Event::TAO_LF_Event (void)
  : state_ (TAO_LF_Event::LFS_IDLE)
  , follower_ (0)
{
}

TAO_LF_Event::~TAO_LF_Event (void)
{
}

void
TAO_LF_Event::state_changed (int new_state,
                             TAO_Leader_Follower &lf)
{
  ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ());

  if (this->is_state_final () == 0)
    {
      this->state_changed_i (new_state);

      /// Sort of double-checked optimization..
      if (this->follower_ != 0)
        this->follower_->signal ();
    }
}


void
TAO_LF_Event::set_state (int new_state)
{
  this->state_ = new_state;
}