compareAndSetVolatileSlot

Perform an atomic compare-and-set on a slot of the given array. If the value in the slot is the same Kotlin object (under ===) as the reference, replace it with the newValue and answer true. Otherwise answer false.

Return

The previous value from the specified slot.

Parameters

field

An enumeration value that defines the field ordering.

reference

The object to compare (by identity) against the current slot value.

newValue

The object to store at the specified slot.