updateAndGet

fun AtomicLong.updateAndGet(updateFunction: (Long) -> Long): Long

Atomically updates (with memory effects as specified by {@link VarHandle#compareAndSet}) the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.

Return

the updated value

Since

1.8

Parameters

updateFunction

a side-effect-free function