counter_t Class ReferenceA thread safe counter.
More...
| ||||||||||||||||||||||||||||||||
Public Member Functions | |
| counter_t () | |
| bool | decrement () |
| void | increment () |
| bool | is_one () const |
Detailed Description
A counter_t is a noncopyable thread safe counter, useful for managing the reference count of a shared resource.
- Rationale:
- Note:
- The counter_t class is thread safe when compiled with BOOST_HAS_THREADS defined.
Definition at line 74 of file counter.hpp.
Constructor & Destructor Documentation
| counter_t | ( | ) |
Default constructor. The counter is initialized to 1.
Definition at line 80 of file counter.hpp.
Member Function Documentation
| bool decrement | ( | ) |
Decrements the counter by one.
- Returns:
trueif the counter is zero at the end of this operation;falseotherwise.
Definition at line 90 of file counter.hpp.
| void increment | ( | ) |
Increments the counter by one.
Definition at line 85 of file counter.hpp.
| bool is_one | ( | ) | const |
Checks to see if the counter is one.
- Returns:
trueif the counter is one;falseotherwise.
Definition at line 95 of file counter.hpp.

