compareAndSet method

Boolean compareAndSet(
  1. T expectedValue,
  2. T newValue
)

Atomically sets the value to the given newValue if the current value equals the expectedValue, returns true if the operation was successful and false only if the current value was not equal to the expectedValue.

Implementation

external Boolean compareAndSet(T expectedValue, T newValue);