kotlinx.coroutines
kotlinx.coroutines copied to clipboard
docs: fix example for channel, do not assume a single-threaded dispatcher
trafficstars
This example illustrating when send suspends works on a single-threaded dispatcher, but is send guaranteed to suspend on a multithreaded dispatcher?
val channel = Channel<Int>()
launch {
check(channel.receive() == 5)
}
channel.send(5) // suspends until 5 is received