Skip to content

Commit

Permalink
Stabilize SendChannel.isClosedForSend
Browse files Browse the repository at this point in the history
Fixes #3448
  • Loading branch information
qwwdfsad committed Nov 1, 2022
1 parent 6c9d358 commit 9b344ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions kotlinx-coroutines-core/common/src/channels/Channel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ import kotlin.jvm.*
*/
public interface SendChannel<in E> {
/**
* Returns `true` if this channel was closed by an invocation of [close]. This means that
* calling [send] will result in an exception.
* Returns `true` if this channel was closed by an invocation of [close] or its receiving side was [cancelled][ReceiveChannel.cancel].
* This means that calling [send] will result in an exception.
*
* **Note: This is an experimental api.** This property may change its semantics and/or name in the future.
* Note that if this property returns `false`, it does not guarantee that consecutive call [send] will succeed, as the
* channel can be concurrently closed right after the check. For such scenarios, it is recommended to use [trySend] instead.
*
* @see SendChannel.close
* @see ReceiveChannel.cancel
*/
@ExperimentalCoroutinesApi
public val isClosedForSend: Boolean

/**
Expand Down

0 comments on commit 9b344ef

Please sign in to comment.