Atomic object. Use with care, this does not magically make it thread-safe to mutate objects. Not supported on JavaScript or C++.

Static methods

@:noExprstaticcompareExchange(this:AtomicObject<T>, expected:T, replacement:T):T

Atomically compares the value of a with expected and replaces a with replacement if they are equal.. Returns the original value of a.

Note that comparison is done by reference, and not by value. While this is expected for most objects, this might give unexpected behaviour for strings.

@:noExprstaticexchange(this:AtomicObject<T>, value:T):T

Atomically exchanges a with value. Returns the original value of a.

@:noExprstaticload(this:AtomicObject<T>):T

Atomically fetches the value of a.

@:noExprstaticstore(this:AtomicObject<T>, value:T):T

Atomically stores value into a. Returns the value that has been stored.