Hey, I stumbled upon something strange -> when ...
# coroutines
m
Hey, I stumbled upon something strange -> when calling a Channel from a suspending lambda...the Channel get stucked...is this expected?:
Copy code
fun randomFunction() {
    val channel = Channel<String>()
    val lambda = suspend {
        channel.send("abc")
    }

    runBlocking(randomContext) {
        lambda()

        println(channel.receive())
    }
}
s
That's normal, you're using a rendezvous channel (zero capacity) so the call to
send
will suspend until something receives the item. It would happen even without the lambda.
👍 1
m
Thx for the answer...I had not in mind that send can also suspended.