DUNE: Uniform Navigational Environment  2016.09.0
DUNE::Concurrency::AtomicCounter Class Reference

Detailed Description

Simple counter with atomic operations.

Public Member Functions

 AtomicCounter (int value=0)
 
int add (int value)
 
int sub (int value)
 

Constructor & Destructor Documentation

DUNE::Concurrency::AtomicCounter::AtomicCounter ( int  value = 0)
inline

Constructor.

Parameters
valueinitial counter value.

Member Function Documentation

int DUNE::Concurrency::AtomicCounter::add ( int  value)
inline

Atomically add a number to the current value and return the result.

Parameters
valuenumber to add.
Returns
value after addition.
int DUNE::Concurrency::AtomicCounter::sub ( int  value)
inline

Atomically subtract a number to the current value and return the result.

Parameters
valuenumber to subtract.
Returns
value after subtraction.
Collaboration diagram for DUNE::Concurrency::AtomicCounter:
Collaboration graph