summaryrefslogtreecommitdiff
path: root/TAO/tao/Follower.cpp
blob: 917eabd0dcae1c832baeadef91eb09bca7485b6c (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
// -*- C++ -*-
// $Id$

#include "tao/Follower.h"
#include "tao/Leader_Follower.h"

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

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

TAO_Follower::TAO_Follower (TAO_Leader_Follower &leader_follower)
  : leader_follower_ (leader_follower)
  , condition_ (leader_follower.lock ())
{
}

TAO_Follower::~TAO_Follower (void)
{
}

int
TAO_Follower::signal (void)
{
  // We *must* remove ourselves from the list of followers, otherwise
  // we could get signalled twice: to wake up as a follower and as the
  // next leader.
  // The follower may not be there if the reply is received while
  // the consumer is not yet waiting for it (i.e. it send the
  // request but has not blocked to receive the reply yet).
  // Ignore errors.
  (void) this->leader_follower_.remove_follower (this);

  return this->condition_.signal ();
}