SHOGUN  v3.0.0
 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__

SHOGUN Machine Learning Toolbox - Documentation