zak.taccardi
10/24/2019, 5:46 PMCoroutineScope
backed by a multi-thread dispatcher. I also have a Channel<Int>
that needs to receive incoming messages.
val scope = CoroutineScope(Dispatchers.Default)
val channel: Channel<Int> = TODO()
fun onNewInt launch`(newInt: Int) {
// `newInt` is delivered from outside a coroutine
// what is the appropriate way to emit to the channel?
}
I see two possibilities (see code snippet)zak.taccardi
10/24/2019, 5:46 PM1
or 2
for preferred approachwithoutclass
10/24/2019, 5:48 PMUNLIMITED
may not be what you want if you have slow consumerswithoutclass
10/24/2019, 5:49 PMoctylFractal
10/24/2019, 5:49 PMsendBlocking
rather than offergildor
10/24/2019, 11:14 PMzak.taccardi
10/24/2019, 11:15 PMscope.launch { }