Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages

kBool kAtomic32s_CompareExchange | ( | kAtomic32s * | atomic,
|  | k32s | oldValue,
|  | k32s | value
| ) |  |

Conditionally exchanges the value of an atomic variable.

If the atomic value is equal to the oldValue argument, then it is replaced by the value argument.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.
  oldValue | Previous atomic value.
  value | New atomic value.

Returns
  kTRUE if the exchange succeeded.