SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
AtomicCounter Class Reference

#include <AtomicCounter.h>

Public Member Functions

 AtomicCounter (const char *name)
 
 AtomicCounter (const char *name, int value)
 
 ~AtomicCounter ()
 Destroy the atomic counter. More...
 
 operator int () const
 
int operator++ ()
 
int operator++ (int)
 Increment the counter and return the old value. More...
 
int operator-- ()
 
int operator-- (int)
 Decrement the counter and return the old value. More...
 
void set (int)
 Set the counter to a new value. More...
 

Constructor & Destructor Documentation

AtomicCounter ( const char *  name)

Create an atomic counter with an unspecified initial value. name should be a static string which describes the primitive for debugging purposes.

AtomicCounter ( const char *  name,
int  value 
)

Create an atomic counter with an initial value. name should be a static string which describes the primitive for debugging purposes.

Destroy the atomic counter.

Member Function Documentation

operator int ( ) const

Allows the atomic counter to be used in expressions like a normal integer. Note that multiple calls to this function may return different values if other threads are manipulating the counter.

int operator++ ( )

Increment the counter and return the new value. This does not return AtomicCounter& like a normal ++ operator would, because it would destroy atomicity

int operator++ ( int  )

Increment the counter and return the old value.

int operator-- ( )

Decrement the counter and return the new value This does not return AtomicCounter& like a normal – operator would, because it would destroy atomicity

int operator-- ( int  )

Decrement the counter and return the old value.

void set ( int  v)

Set the counter to a new value.


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