The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CWaitableCounter Class Reference
[Win32 Synchronization primitives]

Collaboration diagram for CWaitableCounter:

List of all members.


Detailed Description

A counter that can be incremented and decremented and where you can wait on it either becoming zero or becoming non-zero.


Public Member Functions

 CWaitableCounter (long initialCount=0)
 Create a waitable counter with the supplied initial count.
 CWaitableCounter (const CWaitableCounter &rhs)
 ~CWaitableCounter ()
CWaitableCounteroperator= (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 IWaitableGetAtZeroWaitObject () const
 Obtain an interface to an object to wait on for the count to become zero.
const IWaitableGetNotAtZeroWaitObject () 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...


Constructor & Destructor Documentation

CWaitableCounter ( long  initialCount = 0  )  [explicit]

Create a waitable counter with the supplied initial count.

CWaitableCounter ( const CWaitableCounter rhs  ) 

~CWaitableCounter (  ) 


Member Function Documentation

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.


Generated on Sun Sep 12 19:08:55 2021 for The Server Framework - v7.4 by doxygen 1.5.3