A class for thread-safe reference counting. More...
#include <ref-count.hpp>
Public Member Functions | |
RefCount (unsigned long int n) | |
Initialize. | |
void | inc (void) |
Increment counter. | |
bool | dec (void) |
Decrement counter and return true if it hits zero. | |
operator bool (void) const | |
Test whether reference count is non-zero. | |
Protected Attributes | |
std::atomic_ulong | n |
The reference count. | |
A class for thread-safe reference counting.
Definition at line 39 of file ref-count.hpp.
|
inline |
Initialize.
Definition at line 55 of file ref-count.hpp.
|
inline |
Increment counter.
Definition at line 59 of file ref-count.hpp.
|
inline |
Decrement counter and return true if it hits zero.
Definition at line 63 of file ref-count.hpp.
|
inline |
Test whether reference count is non-zero.
Definition at line 67 of file ref-count.hpp.
|
protected |
The reference count.
Definition at line 42 of file ref-count.hpp.