SysCpuAtomicAdd64 (FUN)

FUNCTION SysCpuAtomicAdd64 : LINT

<description>

Function to increment the content of the given pointer by nSum in one atomic operation (task safe). IMPLEMENTATION NOTE: - Add/Sub the value to the content of the pointer - Return the value after the Add/Sub operation Both things must be done atomic!

</description> <result><p>RESULT: Returns the value after the increment operation in an atomic way! </p></result> <SIL2/>

InOut:

Scope

Name

Type

Comment

Return

SysCpuAtomicAdd64

LINT

Input

piValue

POINTER TO LINT

<param name=”piValue” type=”INOUT”>Pointer to the value to increment</param>

nSum

LINT

<param name=”nSum” type=”IN”>Summand for the operation. &gt;0 to increment, &lt;0 to decrement</param>

pResult

POINTER TO RTS_IEC_RESULT

<param name=”pResult” type=”OUT”>Pointer to runtime system error code (see CmpErrors.library)</param>