| 
    Lunchbox
    1.8.0
    
   | 
 
A variable with atomic semantics and standalone atomic operations. More...
#include <atomic.h>
 Collaboration diagram for lunchbox::Atomic< T >:Public Member Functions | |
| Atomic (const T v=0) | |
| Construct a new atomic variable with an initial value.   | |
| Atomic (const Atomic< T > &v) | |
| Construct a copy of an atomic variable.   | |
| operator T (void) const | |
| void | operator= (const T v) | 
| Assign a new value.   | |
| void | operator= (const Atomic< T > &v) | 
| Assign a new value.   | |
| T | operator+= (T v) | 
| Atomically add a value and return the new value.   | |
| T | operator-= (T v) | 
| Atomically substract a value and return the new value.   | |
| T | operator++ (void) | 
| Atomically increment by one and return the new value.   | |
| T | operator-- (void) | 
| Atomically decrement by one and return the new value.   | |
| T | operator++ (int) | 
| Atomically increment by one and return the old value.   | |
| T | operator-- (int) | 
| Atomically decrement by one and return the old value.   | |
| bool | operator== (const Atomic< T > &rhs) const | 
| bool | operator!= (const Atomic< T > &rhs) const | 
| bool | compareAndSwap (const T expected, const T newValue) | 
| Perform a compare-and-swap atomic operation.   | |
Static Public Member Functions | |
| static T | getAndAdd (T &value, const T increment) | 
| static T | getAndSub (T &value, const T increment) | 
| static T | addAndGet (T &value, const T increment) | 
| static T | subAndGet (T &value, const T increment) | 
| static T | incAndGet (T &value) | 
| static T | decAndGet (T &value) | 
| static bool | compareAndSwap (T *value, const T expected, const T newValue) | 
| Perform a compare-and-swap atomic operation.   | |
A variable with atomic semantics and standalone atomic operations.
Atomic variables can be modified safely from multiple threads concurrently. They are useful to implement lock-free algorithms.
For implementation reasons, only signed atomic variables are supported, of which only int32_t is implemented right now.
      
  | 
  explicit | 
| lunchbox::Atomic< T >::Atomic | ( | const Atomic< T > & | v | ) | 
      
  | 
  static | 
Definition at line 268 of file atomic.h.
References lunchbox::memoryBarrierAcquire(), and lunchbox::memoryBarrierRelease().
 Here is the call graph for this function:
      
  | 
  static | 
Perform a compare-and-swap atomic operation.
| bool lunchbox::Atomic< T >::compareAndSwap | ( | const T | expected, | 
| const T | newValue | ||
| ) | 
      
  | 
  static | 
      
  | 
  static | 
Definition at line 238 of file atomic.h.
References lunchbox::memoryBarrierAcquire(), and lunchbox::memoryBarrierRelease().
 Here is the call graph for this function:
      
  | 
  static | 
Definition at line 253 of file atomic.h.
References lunchbox::memoryBarrierAcquire(), and lunchbox::memoryBarrierRelease().
 Here is the call graph for this function:
      
  | 
  static | 
| lunchbox::Atomic< T >::operator T | ( | void | ) | const | 
Definition at line 315 of file atomic.h.
References lunchbox::memoryBarrierAcquire().
 Here is the call graph for this function:| bool lunchbox::Atomic< T >::operator!= | ( | const Atomic< T > & | rhs | ) | const | 
Definition at line 369 of file atomic.h.
References lunchbox::memoryBarrier().
 Here is the call graph for this function:| T lunchbox::Atomic< T >::operator++ | ( | void | ) | 
| T lunchbox::Atomic< T >::operator++ | ( | int | ) | 
| T lunchbox::Atomic< T >::operator+= | ( | T | v | ) | 
| T lunchbox::Atomic< T >::operator-- | ( | void | ) | 
| T lunchbox::Atomic< T >::operator-- | ( | int | ) | 
| T lunchbox::Atomic< T >::operator-= | ( | T | v | ) | 
| void lunchbox::Atomic< T >::operator= | ( | const T | v | ) | 
Assign a new value.
Definition at line 321 of file atomic.h.
References lunchbox::memoryBarrier().
 Here is the call graph for this function:| void lunchbox::Atomic< T >::operator= | ( | const Atomic< T > & | v | ) | 
Assign a new value.
Not thread-safe!
Definition at line 327 of file atomic.h.
References lunchbox::memoryBarrier().
 Here is the call graph for this function:| bool lunchbox::Atomic< T >::operator== | ( | const Atomic< T > & | rhs | ) | const | 
Definition at line 363 of file atomic.h.
References lunchbox::memoryBarrier().
 Here is the call graph for this function:
      
  | 
  static | 
Definition at line 283 of file atomic.h.
References lunchbox::memoryBarrierAcquire(), and lunchbox::memoryBarrierRelease().
 Here is the call graph for this function:
 1.8.1.2