Hello everybody, Good Morning. I can not find this...
# android
s
Hello everybody, Good Morning. I can not find this file
AtomicInt
Documentation: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-atomic-int/ My implement in Gradle:
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31
so Which libraries I should implement in project?
g
This is native only class (see, there is platoform tag near class and every method to check on which platform it available)
on JVM you need java.util.concurrent.atomic.AtomicInteger
👍 1
🎉 1
e
or use atomicfu
❤️ 1
g
Careful with atomicfu, it’s a bit lower level, if you target only jvm/android I would stick with AtomicInteger
❤️ 1
s
Thanks @gildor @ephemient
@gildor What problems did you have while using
atomicfu
?
g
I don’t have any problem, just pointed out that it lower level,there are some limitations how you shoukld use it (for example avoid exposing it, wich is not a problem with AtomicInteger
e
the "Dos and Don'ts" in atomicfu's readme is a good rundown of its limitations
I agree that if you're targeting JVM only, then just use the JVM's built-in atomics, unless you are in some low-level situation in which you'd be using volatiles, in which case use atomicfu