library of assembled shared sources

http://lass.cocamware.com

Atomic

atomic operations and tools for lock-free algorithms More...


Data Structures

class  lass::util::TaggedPtr< T >
 Pointer with a tag for ABA salvation

Some lock-free algorithms suffer from the ABA problem when acting on pointers. More...

struct  lass::util::impl::AtomicOperations< 1 >
struct  lass::util::impl::AtomicOperations< 2 >
struct  lass::util::impl::AtomicOperations< 4 >
struct  lass::util::impl::AtomicOperations< 8 >

Functions

template<typename T >
bool lass::util::atomicCompareAndSwap (volatile T &dest, T expectedValue, T newValue)
 Performs the following pseudocode in an atomic way (no other threads can intervene):.
template<typename T1 , typename T2 >
bool lass::util::atomicCompareAndSwap (volatile T1 &dest1, T1 expected1, T2 expected2, T1 new1, T2 new2)
 Performs the following pseudocode in an atomic way (no other threads can intervene):.
template<typename T >
void lass::util::atomicIncrement (volatile T &value)
 Performs the following pseudocode in an atomic way (no other threads can intervene):.
template<typename T >
void lass::util::atomicDecrement (volatile T &value)
 Performs the following pseudocode in an atomic way (no other threads can intervene):.


Detailed Description

atomic operations and tools for lock-free algorithms

Function Documentation

template<typename T >
bool lass::util::atomicCompareAndSwap ( volatile T &  dest,
expectedValue,
newValue 
) [inline]

template<typename T1 , typename T2 >
bool lass::util::atomicCompareAndSwap ( volatile T1 &  dest1,
T1  expected1,
T2  expected2,
T1  new1,
T2  new2 
) [inline]

Performs the following pseudocode in an atomic way (no other threads can intervene):.

      if (dest1 != expectedValue1 || *(T2*)(&dest1 + sizeof(T1)) != expected2) return false;
      dest1 = new1;
      dest2 = new2;
      return true;

Does not exist for 64-bit types (there's no 128-bit CAS).

Definition at line 90 of file atomic.h.

References LASS_META_ASSERT.

template<typename T >
void lass::util::atomicIncrement ( volatile T &  value  )  [inline]

template<typename T >
void lass::util::atomicDecrement ( volatile T &  value  )  [inline]


Generated on Mon Nov 10 14:22:06 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo