Skip to content

MTY_Atomic64CAS

chrisd1100 edited this page Aug 25, 2022 · 1 revision

Compare two 64-bit values and if the same, atomically set to a new value.

All atomic operations in libmatoya create a full memory barrier.

bool MTY_Atomic64CAS(
    MTY_Atomic64 * atomic,
    int64_t        oldValue,
    int64_t        newValue
);

Parameters

atomic (MTY_Atomic64 *)

An MTY_Atomic64.

oldValue (int64_t)

Value to compare against the atomic.

newValue (int64_t)

Value the atomic is set to if oldValue matches the atomic.

Return value

bool

If the atomic is set to newValue, returns true, otherwise false.

Platform support

Windows   macOS   Android   Linux  

See also

Module: Thread

Clone this wiki locally