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

Francis Mariano

02/12/2021, 12:31 PM
Copy code
@ThreadLocal
object SharedFlowRepository {

    private var repositoryScope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)

    @SharedImmutable // No works here
    private val _devices = MutableSharedFlow<Int>()
    val devices = _devices.asSharedFlow()
Hello guys. I would like to share the
devices
property with other threads in kotlin/native. The singleton
SharedFlowRepository
is frozen and shared but the
@ThreadLocal
annotation removes its frozen behaviour. How can I to share a
val property
with others threads when the singleton object have a
@ThreadLocal
annotation ?