SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RefCount.h
Go to the documentation of this file.
1 #include <shogun/lib/config.h>
2 
3 #ifdef HAVE_CXX11_ATOMIC
4 #include <atomic>
5 #endif
6 
7 #include <shogun/lib/common.h>
8 #include <shogun/lib/Lock.h>
9 
10 #ifndef _REFCOUNT__H__
11 #define _REFCOUNT__H__
12 
13 namespace shogun
14 {
18 class RefCount
19 {
20 public:
25  RefCount(int32_t ref_start=0) : rc(ref_start) {}
26 
31  int32_t ref();
32 
37  int32_t unref();
38 
43  int32_t ref_count();
44 
46 #ifdef HAVE_CXX11_ATOMIC
47  volatile std::atomic<int> rc;
48 #else
49  int32_t rc;
50 
53 #endif
54 };
55 }
56 
57 #endif //_REFCOUNT__H__
int32_t ref_count()
Definition: RefCount.cpp:31
RefCount(int32_t ref_start=0)
Definition: RefCount.h:25
Class Lock used for synchronization in concurrent programs.
Definition: Lock.h:17
int32_t unref()
Definition: RefCount.cpp:18
int32_t ref()
Definition: RefCount.cpp:5
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
int32_t rc
Definition: RefCount.h:49

SHOGUN Machine Learning Toolbox - Documentation