/usr/include/shogun/lib/RefCount.h is in libshogun-dev 3.2.0-7.5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifdef HAVE_CXX11_ATOMIC
#include <atomic>
#endif
#include <shogun/lib/common.h>
#include <shogun/lib/Lock.h>
#ifndef _REFCOUNT__H__
#define _REFCOUNT__H__
namespace shogun
{
/** brief This class implements a thread-safe counter used for
* reference counting.
*/
class RefCount
{
public:
/** Constructor
*
* @param ref_start starting value for counter
*/
RefCount(int32_t ref_start=0) : rc(ref_start) {}
/** Increase ref count
*
* @return the new reference count
*/
int32_t ref();
/** Decrease reference count
*
* @return the new reference count
*/
int32_t unref();
/** Get the reference count
*
* @return the reference count
*/
int32_t ref_count();
/** reference count */
#ifdef HAVE_CXX11_ATOMIC
volatile std::atomic<int> rc;
#else
int32_t rc;
/** the lock */
CLock lock;
#endif
};
}
#endif //_REFCOUNT__H__
|