Library of Assembled Shared Sources
|
atomic operations and tools for lock-free algorithms
Data Structures | |
class | lass::util::TaggedPtr< T > |
Pointer with a tag for ABA salvationSome lock-free algorithms suffer from the ABA problem when acting on pointers. More... | |
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): | |
template<typename T> | |
void | lass::util::atomicLock (volatile T &semaphore) |
template<typename T> | |
bool | lass::util::atomicTryLock (volatile T &semaphore) |
template<typename T> | |
void | lass::util::atomicUnlock (volatile T &semaphore) |
bool lass::util::atomicCompareAndSwap | ( | volatile T & | dest, |
T | expectedValue, | ||
T | newValue ) |
Performs the following pseudocode in an atomic way (no other threads can intervene):
Definition at line 94 of file atomic.h.
Referenced by atomicLock(), and atomicTryLock().
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):
Does not exist for 64-bit types (there's no 128-bit CAS).
Definition at line 117 of file atomic.h.
References LASS_META_ASSERT.
void lass::util::atomicIncrement | ( | volatile T & | value | ) |
Performs the following pseudocode in an atomic way (no other threads can intervene):
Definition at line 137 of file atomic.h.
Referenced by atomicUnlock().
void lass::util::atomicDecrement | ( | volatile T & | value | ) |
Performs the following pseudocode in an atomic way (no other threads can intervene):
void lass::util::atomicLock | ( | volatile T & | semaphore | ) |
Definition at line 168 of file atomic.h.
References atomicCompareAndSwap().
bool lass::util::atomicTryLock | ( | volatile T & | semaphore | ) |
Definition at line 186 of file atomic.h.
References atomicCompareAndSwap().
void lass::util::atomicUnlock | ( | volatile T & | semaphore | ) |