orbit-util / orbit.util.concurrent / java.util.concurrent.atomic.AtomicReference

Extensions for java.util.concurrent.atomic.AtomicReference

atomicSet

Atomically updates a reference with the logic provided in the code block. The code block should be free of side-effects as it may be run multiple times. The initial value of the reference is passed to the code block and should be used for manipulation.

fun <T> AtomicReference<T>.atomicSet(block: (T) -> T): T