https://kotlinlang.org logo
Title
a

Andrew Gazelka

04/27/2019, 6:35 PM
/**
 * Infinite loop that reads this atomic variable and performs the specified [action] on its value.
 */
public inline fun <T> AtomicRef<T>.loop(action: (T) -> Unit): Nothing {
    while (true) {
        action(value)
    }
}
ummm I am confused... why would anyone use this? Why not just
AtomicRef#value
? (in regards to https://github.com/Kotlin/kotlinx.coroutines/blob/69c26dfbcefc24c66aadc586f9b5129894516bee/kotlinx-coroutines-core/common/src/sync/Mutex.kt#L146-L155)