blob: e73d1f22cc5d9b2d8fd3bec5e854bf96082fab09 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// This may look like C, but it's really
// -*- C++ -*-
//=============================================================================
/**
* @file Configurable_Refcount.h
*
* $Id$
*
* Definition for a synchronised refcountable interface.
*
* @author Fred Kuhns <fredk@cs.wustl.edu>
*/
//=============================================================================
#ifndef TAO_CONFIGURABLE_REFCOUNT_H
#define TAO_CONFIGURABLE_REFCOUNT_H
#include /**/ "ace/pre.h"
#include "ace/Atomic_Op.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Null_Mutex.h"
#include /**/ "tao/TAO_Export.h"
#include "tao/orbconf.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class TAO_Configurable_Refcount
*
* @brief Definition for a synchronised refcountable interface.
*/
class TAO_Export TAO_Configurable_Refcount
{
public:
enum Lock_Type
{
TAO_NULL_LOCK,
TAO_THREAD_LOCK
};
TAO_Configurable_Refcount (Lock_Type type = TAO_THREAD_LOCK,
unsigned long value = 1);
unsigned long increment (void);
unsigned long decrement (void);
unsigned long value (void) const;
private:
Lock_Type type_;
ACE_Atomic_Op<ACE_SYNCH_NULL_MUTEX, unsigned long> null_refcount_;
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> mutex_refcount_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
# include "Configurable_Refcount.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* TAO_CONFIGURABLE_REFCOUNT */
|