getAndUpdate

inline fun <V> Atomic<V>.getAndUpdate(function: (V) -> V): V(source)
inline fun AtomicInt.getAndUpdate(function: (Int) -> Int): Int(source)
inline fun AtomicLong.getAndUpdate(function: (Long) -> Long): Long(source)

Updates variable atomically using the specified function of its value and returns its old value.