ucommon
Public Member Functions | Protected Attributes
ost::MutexCounter Class Reference

The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads. More...

#include <thread.h>

Inherits ost::Mutex.

Public Member Functions

 MutexCounter ()
 Create and optionally name a mutex protected counter.
 MutexCounter (int initial)
 Create and optionally name a mutex protected counter with an initial value.
int operator++ ()
int operator-- ()
- Public Member Functions inherited from ost::Mutex
void enter (void)
void enterMutex (void)
void leave (void)
void leaveMutex (void)
bool test (void)
bool tryEnterMutex (void)

Protected Attributes

volatile int counter

Additional Inherited Members

- Protected Member Functions inherited from ucommon::RecursiveMutex
unsigned getLocking (void)
 Get the number of recursive locking levels.
unsigned getWaiting (void)
 Get the number of threads waiting on lock.
void lock (void)
 Acquire or increase locking.
bool lock (timeout_t timeout)
 Timed lock request.
 RecursiveMutex ()
 Create rexlock.
void release (void)
 Release or decrease locking.
void Exlock (void)
void Unlock (void)
- Static Protected Member Functions inherited from ucommon::RecursiveMutex
static void lock (RecursiveMutex &rex)
 Convenience method to lock a recursive lock.
static void release (RecursiveMutex &rex)
 Convenience method to unlock a recursive lock.

Detailed Description

The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads.

A Mutex is used to protect access to the counter variable (an integer). An initial value can be specified for the counter, and it can be manipulated with the ++ and – operators.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Thread protected integer counter.

Definition at line 73 of file thread.h.

Constructor & Destructor Documentation

ost::MutexCounter::MutexCounter ( int  initial)

Create and optionally name a mutex protected counter with an initial value.

Parameters
initialvalue of counter.

The documentation for this class was generated from the following file: