compareAndExchange
and compareAndSet
). To avoid
confusion over plain or volatile memory effects it is recommended that
the method weakCompareAndSetPlain
be used instead.
Possibly atomically sets the element at index i
to
newValue
if the element's current value == expectedValue
,
with memory effects as specified by VarHandle.weakCompareAndSetPlain
.
i | the index | |
expectedValue | the expected value | |
newValue | the new value |
true
if successful
weakCompareAndSetPlain
Diagram: AtomicArray