Gecode::Support::RefCount Class Reference
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. |
Detailed Description
A class for thread-safe reference counting.
Definition at line 39 of file ref-count.hpp.
Constructor & Destructor Documentation
Gecode::Support::RefCount::RefCount | ( | unsigned long int | n | ) | [inline] |
Initialize.
Definition at line 55 of file ref-count.hpp.
Member Function Documentation
void Gecode::Support::RefCount::inc | ( | void | ) | [inline] |
Increment counter.
Definition at line 59 of file ref-count.hpp.
bool Gecode::Support::RefCount::dec | ( | void | ) | [inline] |
Decrement counter and return true if it hits zero.
Definition at line 63 of file ref-count.hpp.
Gecode::Support::RefCount::operator bool | ( | void | ) | const [inline] |
Test whether reference count is non-zero.
Definition at line 67 of file ref-count.hpp.
Member Data Documentation
std::atomic_ulong Gecode::Support::RefCount::n [protected] |
The reference count.
Definition at line 42 of file ref-count.hpp.
The documentation for this class was generated from the following file:
- gecode/support/ref-count.hpp