Public Member Functions | |
CWaitableCounter (long initialCount=0) | |
Create a waitable counter with the supplied initial count. | |
CWaitableCounter (const CWaitableCounter &rhs) | |
~CWaitableCounter () | |
CWaitableCounter & | operator= (const CWaitableCounter &rhs) |
void | SetValue (long value) |
bool | Increment () |
Increments the counter. Returns true if the counter was previously at zero. | |
bool | Add (long value) |
Adds the supplied amount to the counter value. Returns true if the counter was previously at zero. | |
bool | Decrement () |
Decrements the counter. Returns true if the counter is now at zero. | |
bool | Subtract (long value) |
Subtracts the supplied amount from the counter value. Returns true if the counter is now at zero. | |
long | GetValue () const |
const IWaitable & | GetAtZeroWaitObject () const |
Obtain an interface to an object to wait on for the count to become zero. | |
const IWaitable & | GetNotAtZeroWaitObject () const |
Obtain an interface to an object to wait on for the count to become non zero. | |
Classes | |
class | Decrementer |
A class that provides support for scope based decrementing of a waitable counter. The count is decreased for the life of the Decrementer; that is, it is decremented in the constructor of the and incremented in the destrutor. More... | |
class | Incrementer |
A class that provides support for scope based incrementing of a waitable counter. The count is incremented for the life of the Incrementer; that is, it is incremented in the constructor of the and decremented in the destrutor. More... |
CWaitableCounter | ( | long | initialCount = 0 |
) | [explicit] |
Create a waitable counter with the supplied initial count.
CWaitableCounter | ( | const CWaitableCounter & | rhs | ) |
~CWaitableCounter | ( | ) |
CWaitableCounter& operator= | ( | const CWaitableCounter & | rhs | ) |
void SetValue | ( | long | value | ) |
bool Increment | ( | ) |
Increments the counter. Returns true if the counter was previously at zero.
bool Add | ( | long | value | ) |
Adds the supplied amount to the counter value. Returns true if the counter was previously at zero.
bool Decrement | ( | ) |
Decrements the counter. Returns true if the counter is now at zero.
bool Subtract | ( | long | value | ) |
Subtracts the supplied amount from the counter value. Returns true if the counter is now at zero.
long GetValue | ( | ) | const |
const IWaitable & GetAtZeroWaitObject | ( | ) | const |
Obtain an interface to an object to wait on for the count to become zero.
const IWaitable & GetNotAtZeroWaitObject | ( | ) | const |
Obtain an interface to an object to wait on for the count to become non zero.