SysCpuAtomicCompareAndSwap (FUN)
FUNCTION SysCpuAtomicCompareAndSwap : RTS_IEC_RESULT
<description> Function for compare-and-swap in one atomic operation (task safe). Supports only 32- and 64-bit types
The function compares the pAddress value with the pCompareValue value. If the pAddress value is equal to the pCompareValue value, the pSwapValue value is stored in the address specified by pAddress. Otherwise, no operation is performed.
The function was successful if the *pSwapValue value is stored in the address specified by pAddress. </description> <result><p>RESULT: Returns ERR_OK if the swap was successful (if the pSwapValue value is stored in the address specified by pAddress) </p></result> <SIL2/>
- InOut:
Scope
Name
Type
Comment
Return
SysCpuAtomicCompareAndSwapRTS_IEC_RESULTInput
pAddressPOINTER TO BYTE
pointer to the value to test
pSwapValuePOINTER TO BYTE
pointer to new valid
pCompareValuePOINTER TO BYTE
pointer to compare value
valueSizeUSINTsize of the value