SHOGUN  v3.1.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RefCount.h
Go to the documentation of this file.
1 #ifdef HAVE_CXX11_ATOMIC
2 #include <atomic>
3 #endif
4 
5 #include <shogun/lib/common.h>
6 #include <shogun/lib/Lock.h>
7 
8 #ifndef _REFCOUNT__H__
9 #define _REFCOUNT__H__
10 
11 namespace shogun
12 {
16 class RefCount
17 {
18 public:
23  RefCount(int32_t ref_start=0) : rc(ref_start) {}
24 
29  int32_t ref();
30 
35  int32_t unref();
36 
41  int32_t ref_count();
42 
44 #ifdef HAVE_CXX11_ATOMIC
45  volatile std::atomic<int> rc;
46 #else
47  int32_t rc;
48 
51 #endif
52 };
53 }
54 
55 #endif //_REFCOUNT__H__
int32_t ref_count()
Definition: RefCount.cpp:31
RefCount(int32_t ref_start=0)
Definition: RefCount.h:23
Class Lock used for synchronization in concurrent programs.
Definition: Lock.h:14
int32_t unref()
Definition: RefCount.cpp:18
int32_t ref()
Definition: RefCount.cpp:5
int32_t rc
Definition: RefCount.h:47

SHOGUN Machine Learning Toolbox - Documentation