https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
w

wuseal

12/31/2020, 10:53 AM
Hi, can anybody tell me how to use [AtomicInt](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-atomic-int/) in common code?
m

mdabrowski89

12/31/2020, 11:50 AM
As far as I know AtomitInt is available only for native target, so it cant be use in common code
😢 1
t

travis

12/31/2020, 2:36 PM
For atomics in common code, you probably want to use https://github.com/Kotlin/kotlinx.atomicfu
❤️ 1
a

andylamax

01/01/2021, 6:19 AM
Copy code
val int: AtomicInt = atomic(1)

// of just

val int = atomic(1)
👍 2
w

wuseal

01/05/2021, 3:45 AM
@travis @andylamax Thank you guys giving me this repository advice,This repository is hard for me to understand 😂. I resolved this problem by writing
expect
and
actual
combining method at last.In JVM using
AtomicInteger
36 Views