atomic64_cmpxchg

Atomically compares a 64-bit value with the 64-bit value in the specified memory location, and if the same, replaces the memory value.

Library:LibC
Classification:Other
Service:General C Services

Syntax

  #include <stdlib.h> 
   
  uint64_t atomic64_cmpxchg (
     uint64_t   *addr,
     uint64_t    cmpvalue,
     uint64_t    newvalue);
  

Parameters

addr

(IN) Points to the memory location for the operation.

cmpvalue

(IN) Specifies the value to compare.

newvalue

(IN) Specifies the replacement value if cmpvalue is the same as the value in the memory location.

Return Values

Returns the original value in the memory location.

Remarks

The memory location address is expected to be valid. If an invalid address is passed, the server will abend.

See Also