Adds element to this channel, blocking the caller while this channel is full, and returning either successful result when the element was added, or failed result representing closed channel with a corresponding exception.

This is a way to call Channel.send method in a safe manner inside a blocking code using runBlocking and catching, so this function should not be used from coroutine.

Example of usage:

// From callback API
.onSuccess { /* request next element or debug log */}
.onFailure { t: Throwable? -> /* throw or log */}

For this operation it is guaranteed that failure always contains an exception in it.


InterruptedException on JVM if the current thread is interrupted during the blocking send operation.