summaryrefslogtreecommitdiff
path: root/TAO/tao/True_RefCount_Policy.inl
blob: a6db939e1290a7308ba88b09e6223c1b8769fd76 (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
// -*- C++ -*-
//
// $Id$


#include "ace/Guard_T.h"


ACE_INLINE
TAO::True_RefCount_Policy::True_RefCount_Policy (void)
  : lock_ (),
    refcount_ (1)
{
}

ACE_INLINE void
TAO::True_RefCount_Policy::add_ref (void)
{
  ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_);

  ++this->refcount_;
}

ACE_INLINE void
TAO::True_RefCount_Policy::remove_ref (void)
{
  {
    ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_);

    --this->refcount_;

    if (this->refcount_ != 0)
      return;
  }

  delete this;
}