Atomic object. Use with care, this does not magically make it thread-safe to mutate objects. Not supported on JavaScript or C++.
Static methods
staticcompareExchange(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.
staticexchange(this:AtomicObject<T>, value:T):T
Atomically exchanges a
with value
.
Returns the original value of a
.
staticstore(this:AtomicObject<T>, value:T):T
Atomically stores value
into a
.
Returns the value that has been stored.