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