backed by a multi-thread dispatcher. I also have a
Channel<Int>
that needs to receive incoming messages.
Copy code
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?
}
may not be what you want if you have slow consumers
withoutclass
10/24/2019, 5:49 PM
maybe you want 500 items or something, that is if you went with option 2
o
octylFractal
10/24/2019, 5:49 PM
really depends on how you want the channel to operate. if you're aiming for an unlimited back-log, I would vote for 2, as it's more explicit about that. but if you want backpressure, I would set RENDEZVOUS/specific count, and use