update
Update value by AtomicLong.compareAndSet and then return the old value.
while (true) {
val current = value
if (compareAndSet(current, block(current))) {
return current
}
}
Content copied to clipboard
Return
The old value that been exchanged.
Update value by AtomicInt.compareAndSet and then return the old value.
while (true) {
val current = value
if (compareAndSet(current, block(current))) {
return current
}
}
Content copied to clipboard
Return
The old value that been exchanged.
Update value by AtomicRef.compareAndSet and then return the old value.
while (true) {
val current = value
if (compareAndSet(current, block(current))) {
return current
}
}
Content copied to clipboard
Return
The old value that been exchanged.