counter_t Class Reference
Detailed DescriptionA counter_t is a noncopyable thread safe counter, useful for managing the reference count of a shared resource.
counter_t wraps reference count operations that require thread safety into a single class. While this does not guarantee client code will be thread safe, it helps to take a step in that direction. It also cleans up client code and keeps thread-handling scoped to a single file. Consider copy_on_write as an example class that leverages counter_t.
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§ decrement()
Decrements the counter by one.
Definition at line 90 of file counter.hpp. § increment()
Increments the counter by one. Definition at line 85 of file counter.hpp. § is_one()
Checks to see if the counter is one.
Definition at line 95 of file counter.hpp. |