Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

atomic Class Reference

List of all members.

Detailed Description

An atomic integer class.

Useful for threadsafe smart pointers (and probably other stuff too).

Currently implemented in terms of the __exchange_and_add and __atomic_add functions in libstdc++.


Public Methods

 atomic (int val=0)
 Constructs an atomic integer with a given initial value.

word exchange_and_add (int addend)
 Atomically increases the value of the integer and returns its old value.

void add (int addend)
 Atomically increases the value of the integer.

void operator+= (int addend)
 Atomically increases the value of the integer.

void operator-= (int addend)
 Atomically decreases the value of the integer.

void operator++ ()
 Atomically increments the value of the integer.

void operator-- ()
 Atomically decrements the value of the integer.

int operator++ (int)
 Atomically increments the value of the integer and returns its old value.

int operator-- (int)
 Atomically decrements the value of the integer and returns its old value.

 operator int () const
 Returns the value of the integer.


Constructor & Destructor Documentation

atomic::atomic int    val = 0
 

Constructs an atomic integer with a given initial value.


Member Function Documentation

void atomic::add int    addend
 

Atomically increases the value of the integer.

word atomic::exchange_and_add int    addend
 

Atomically increases the value of the integer and returns its old value.

atomic::operator int   const
 

Returns the value of the integer.

int atomic::operator++ int   
 

Atomically increments the value of the integer and returns its old value.

void atomic::operator++  
 

Atomically increments the value of the integer.

void atomic::operator+= int    addend
 

Atomically increases the value of the integer.

int atomic::operator-- int   
 

Atomically decrements the value of the integer and returns its old value.

void atomic::operator--  
 

Atomically decrements the value of the integer.

void atomic::operator-= int    addend
 

Atomically decreases the value of the integer.


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL