magnumrocha
04/18/2020, 8:46 PMBroadcastChannel
from other thread in kotlin native?
val myOtherQueue = dispatch_queue_create("my_other_queue")
val myChannel = ConflatedBroadcastChannel(Unit)
val myChannelPointer = StableRef.create(myChannel)
val callback = staticCFunction { value: SomeClass, info: COpaquePointer? ->
if (info == null) { return@staticCFunction }
info.asStableRef<ConflatedBroadcastChannel<Unit>>().get().offer(Unit) // not working: EXC_BAD_ACCESS!
}
SomeNativeApi(myOtherQueue, callback, myChannelPointer.asCPointer())
The problem here is I'm trying to offer value to a ConflatedBroadcastChannel
from other thread than the main thread, right? if so, how to solve it?