so I modified my original example to avoid the com...
# coroutines
u
so I modified my original example to avoid the communication deadlock by just flushing the remaining elements like so:
Copy code
fun <T> Channel<T>.closeAndFlush(cause: Throwable? = null) {
    close(cause)
    while (poll() != null) {}
}