cancel

abstract fun cancel(cause: CancellationException? = null)(source)

Cancels reception of remaining elements from this channel with an optional cause. This function closes the channel with the specified cause (unless it was already closed), removes all buffered sent elements from it, and cancels all open subscriptions. A cause can be used to specify an error message or to provide other details on a cancellation reason for debugging purposes.