Public Member Functions | Private Attributes

threadsafe_counter Class Reference
[Threadsafe Collection API]

Simple synchronized counter. More...

#include <threadsafe_counter.h>

Collaboration diagram for threadsafe_counter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 threadsafe_counter (void) throw ()
long increment (void) throw ()
 returns the authoritative count after the increment
long decrement (void) throw ()
 returns the authoritative count after the decrement
long getCount (void) const throw ()
 currently non-authoritative! Not sure of a use case where that would help (other threads can change the count anyway)

Private Attributes

smart_mutex m_mutex
long m_counter

Detailed Description

Simple synchronized counter.

Handy for any sort of counting that needs to be bumped up/down by different threads.

Definition at line 47 of file threadsafe_counter.h.


Constructor & Destructor Documentation

threadsafe_counter::threadsafe_counter ( void   )  throw () [inline]

Definition at line 49 of file threadsafe_counter.h.


Member Function Documentation

long threadsafe_counter::increment ( void   )  throw () [inline]

returns the authoritative count after the increment

Definition at line 54 of file threadsafe_counter.h.

long threadsafe_counter::decrement ( void   )  throw () [inline]

returns the authoritative count after the decrement

Definition at line 61 of file threadsafe_counter.h.

long threadsafe_counter::getCount ( void   )  const throw () [inline]

currently non-authoritative! Not sure of a use case where that would help (other threads can change the count anyway)

Definition at line 69 of file threadsafe_counter.h.


Member Data Documentation

Definition at line 76 of file threadsafe_counter.h.

Definition at line 77 of file threadsafe_counter.h.


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