AWS IoT Device SDK C: Platform
Platform portability layer
Return to main page ↑
Atomic_CompareAndSwap_u32

Performs an atomic compare-and-swap operation on the given values.

static inline uint32_t Atomic_CompareAndSwap_u32( uint32_t volatile * pDestination,
uint32_t newValue,
uint32_t comparand )
Parameters
[in,out]pDestinationPointer to memory location from where value is to be loaded and checked.
[in]newValueThis value will be written to memory if the comparand matches the value at pDestination.
[in]comparandThis value is compared to the value at pDestination.
Returns
1 if the newValue was written to pDestination; 0 otherwise.