Toby
06/28/2021, 2:24 PMAtomicReference
from the native library? I do not have access to a (getter and) setter. Would I have to implement my own AtomicReference into my project to make it work?diesieben07
06/28/2021, 2:26 PMkotlinx.atomicfu
for a multiplatform atomic reference implementation:
https://github.com/Kotlin/kotlinx.atomicfuephemient
06/28/2021, 2:29 PMephemient
06/28/2021, 2:30 PMToby
06/28/2021, 2:31 PMephemient
06/28/2021, 2:35 PMArkadii Ivanov
06/28/2021, 2:38 PMephemient
06/28/2021, 2:43 PMToby
06/28/2021, 2:48 PMAtomicReference
out of the standard library right? I don't like to have such a massive and experimental library in my project, it should be lightweight and since Kotlin decided to change the memory management, I have to use a lightweight AtomicReference
implementation in Kotlin/Native. Kotlin/JVM has already the Java one which is good and this is what I'm aiming for in Native.ephemient
06/28/2021, 2:50 PMToby
06/28/2021, 2:51 PMArkadii Ivanov
06/28/2021, 2:51 PMutils
module from Reaktive.ephemient
06/28/2021, 2:51 PMToby
06/28/2021, 2:52 PMArkadii Ivanov
06/28/2021, 2:53 PMToby
06/28/2021, 2:53 PMArkadii Ivanov
06/28/2021, 2:53 PMcompareAndSet
and the var value
property. Other functions have to be implemented manually as extensions.Toby
06/28/2021, 2:54 PMephemient
06/28/2021, 2:55 PMfun <T> AtomicReference<T>.set(newValue: T) = whlie (!compareAndSet(value, newValue) {}
is trivialArkadii Ivanov
06/28/2021, 2:55 PMref.value = x
Toby
06/28/2021, 2:56 PMephemient
06/28/2021, 2:56 PMToby
06/28/2021, 2:57 PMrusshwolf
06/28/2021, 4:23 PMArkadii Ivanov
06/28/2021, 4:29 PMephemient
06/28/2021, 4:30 PMephemient
06/28/2021, 4:31 PMArkadii Ivanov
06/28/2021, 4:32 PMrusshwolf
06/28/2021, 4:33 PM