|
◆ atomic_compare_exchange_weak()
template<typename T , typename Allocator >
STDGPU_DEVICE_ONLY bool stdgpu::atomic_compare_exchange_weak |
( |
atomic< T, Allocator > * |
obj, |
|
|
typename atomic< T, Allocator >::value_type * |
expected, |
|
|
const typename atomic< T, Allocator >::value_type |
desired |
|
) |
| |
|
noexcept |
Atomically compares the current value with the given value and exchanges it with the desired one in case the both values are equal.
- Parameters
-
[in] | obj | The atomic object |
[in] | expected | A pointer to the value to expect in the atomic object, will be updated with old value if it has not been changed |
[in] | desired | The value to exchange with the atomic object |
- Returns
- True if the value has been changed to desired, false otherwise
|