cancel

abstract fun cancel(cause: Throwable?): Boolean

Close channel with optional cause cancellation. This is an idempotent operation — subsequent invocations of this function have no effect and return false

Return

true if the channel was cancelled/closed by this invocation, false if the channel was already closed

Parameters

cause

the cause of cancellation, when null a kotlin.coroutines.cancellation.CancellationException will be used