CopperSpice API
1.9.2
|
The QAtomicPointer class is a template providing platform independent atomic operations on pointers. More...
Public Methods | |
QAtomicPointer (const QAtomicPointer< T > &other) | |
QAtomicPointer (T *value=nullptr) | |
T * | fetchAndAddAcquire (std::ptrdiff_t valueToAdd) |
T * | fetchAndAddOrdered (std::ptrdiff_t valueToAdd) |
T * | fetchAndAddRelaxed (std::ptrdiff_t valueToAdd) |
T * | fetchAndAddRelease (std::ptrdiff_t valueToAdd) |
T * | fetchAndStoreAcquire (T *newValue) |
T * | fetchAndStoreOrdered (T *newValue) |
T * | fetchAndStoreRelaxed (T *newValue) |
T * | fetchAndStoreRelease (T *newValue) |
T * | load () const |
T * | load (std::memory_order order) const |
T * | loadAcquire () const |
T * | operator++ () |
T * | operator++ (int) |
T * | operator+= (std::ptrdiff_t value) |
T * | operator-- () |
T * | operator-- (int) |
T * | operator-= (std::ptrdiff_t value) |
QAtomicPointer< T > & | operator= (const QAtomicPointer< T > &other) |
QAtomicPointer< T > & | operator= (T *value) |
void | store (T *newValue) |
void | store (T *newValue, std::memory_order order) |
void | storeRelease (T *newValue) |
bool | testAndSetAcquire (T *expectedValue, T *newValue) |
bool | testAndSetOrdered (T *expectedValue, T *newValue) |
bool | testAndSetRelaxed (T *expectedValue, T *newValue) |
bool | testAndSetRelease (T *expectedValue, T *newValue) |
Static Public Methods | |
static bool | isFetchAndAddNative () |
static bool | isFetchAndAddWaitFree () |
static bool | isFetchAndStoreNative () |
static bool | isFetchAndStoreWaitFree () |
static bool | isTestAndSetNative () |
static bool | isTestAndSetWaitFree () |
The QAtomicPointer class is a template class which provides platform independent atomic operations on pointers. For atomic operations on integers refer to the QAtomicInt class. An atomic operation is one which is guaranteed to free of data races.
This class has several methods which have a parameter which specifies the memory ordering. These are the valid enum values.
Value | Description |
---|---|
std::memory_order_relaxed | memory ordering is unrestricted, allows the compiler and processor to freely reorder non atomic memory access |
std::memory_order_acquire | prevents all read and writes of non atomic data from being moved before the current atomic operation |
std::memory_order_release | prevents all read and writes of non atomic data from being moved after the current atomic operation |
std::memory_order_acq_rel | combination of acquire and release |
std::memory_order_seq_cst | default ordering, all reads and writes will done in the same order as the appear in the source code |
If the current atomic value is equal to the expected value then compareExchange() will store the new value and return true. If the current atomic value is not equal to the expected value compareExchange() will be updated with the current atomic value and this method will return false.
The atomic "fetch and store" methods read the current value of the QAtomicPointer and then assign a new value, returning the original value.
The atomic "fetch and add" methods read the current value of the QAtomicPointer and then add the given value to the current value, returning the original value.
|
inline |
Constructs a QAtomicPointer with the given value.
|
inline |
Copy constructs a new QtomicPointer from other.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then adds valueToAdd to the current value, returning the original value.
This method uses acquire memory ordering semantics which ensures that memory access following the atomic operation (in program order) may not be reordered before the atomic operation.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then adds valueToAdd to the current value, returning the original value.
This method uses ordered memory ordering semantics which ensures that memory access before and after the atomic operation (in program order) may not be reordered.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then adds valueToAdd to the current value, returning the original value.
This method uses relaxed memory ordering semantics leaving the compiler and processor to freely reorder memory accesses.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then adds valueToAdd to the current value, returning the original value.
This method uses release memory ordering semantics, which ensures that memory access before the atomic operation (in program order) may not be reordered after the atomic operation.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then assigns it the newValue, returning the original value.
This method uses acquire memory ordering semantics which ensures that memory access following the atomic operation (in program order) may not be reordered before the atomic operation.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then assigns it the newValue, returning the original value.
This method uses ordered memory ordering semantics which ensures that memory access before and after the atomic operation (in program order) may not be reordered.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then assigns it the newValue, returning the original value.
This method uses relaxed memory ordering semantics leaving the compiler and processor to freely reorder memory accesses.
|
inlinedeprecated |
Reads the current value of this QAtomicPointer and then assigns it the newValue, returning the original value.
This method uses release memory ordering semantics which ensures that memory access before the atomic operation (in program order) may not be reordered after the atomic operation.
|
inlinestatic |
Returns true if "fetch and add" is implemented using atomic processor instructions, otherwise returns false.
|
inlinestatic |
Returns true if atomic "fetch and add" is wait free, false otherwise.
|
inlinestatic |
Returns true if "fetch and store" is implemented using atomic processor instructions, otherwise returns false.
|
inlinestatic |
Returns true if atomic "fetch and store" is wait free, otherwise returns false.
|
inlinestatic |
Returns true if "test and set" is implemented using atomic processor instructions, otherwise returns false.
|
inlinestatic |
Returns true if atomic "test and set" is wait free, otherwise returns false.
|
inline |
Atomically loads the value of this QAtomicPointer using relaxed memory ordering.
|
inline |
Atomically loads the value of this QAtomicPointer using the memory ordering order.
|
inline |
|
inline |
The prefix ++ operator advances the pointer to the next item in memory and returns the new value.
|
inline |
The postfix ++ operator advances the pointer to the next item in memory and returns the old value.
|
inline |
Add value to current pointer and returns the new value.
|
inline |
The prefix – operator decrements the pointer to the previous item in memory and returns the new value.
|
inline |
The postfix – operator decrements the pointer to the previous item in memory and returns the old value.
|
inline |
Subtracts value from the current pointer and returns the new value.
|
inline |
Copy assigns from other and returns a reference to this object.
|
inline |
Assigns value to the current QAtomicPointer and returns a reference to this object.
|
inline |
Atomically stores the newValue value into this atomic type using relaxed memory ordering.
|
inline |
Atomically stores the newValue value into this atomic type using the memory ordering order.
|
inline |
|
inlinedeprecated |
If the current value of this QAtomicPointer is the expectedValue, the test-and-set methods assign the newValue to this QAtomicPointer and return true. If the values are not the same, this method does nothing and returns false.
This method uses acquire memory ordering semantics which ensures that memory access following the atomic operation (in program order) may not be reordered before the atomic operation.
|
inlinedeprecated |
If the current value of this QAtomicPointer is the expectedValue, the test-and-set methods assign the newValue to this QAtomicPointer and return true. If the values are not the same, this method does nothing and returns false.
This method uses ordered memory ordering semantics which ensures that memory access before and after the atomic operation (in program order) may not be reordered.
|
inlinedeprecated |
If the current value of this QAtomicPointer is the expectedValue, the test-and-set methods assign the newValue to this QAtomicPointer and return true. If the values are not the same, this method does nothing and returns false.
This method uses relaxed memory ordering semantics leaving the compiler and processor to freely reorder memory accesses.
|
inlinedeprecated |
If the current value of this QAtomicPointer is the expectedValue, the test-and-set methods assign the newValue to this QAtomicPointer and return true. If the values are not the same, this method does nothing and returns false.
This method uses release memory ordering semantics which ensures memory access before the atomic operation (in program order) may not be reordered after the atomic operation.