Skip to content

Commit 9b344ef

Browse files
committed
Stabilize SendChannel.isClosedForSend
Fixes #3448
1 parent 6c9d358 commit 9b344ef

File tree

1 file changed

+7
-4
lines changed
  • kotlinx-coroutines-core/common/src/channels

1 file changed

+7
-4
lines changed

kotlinx-coroutines-core/common/src/channels/Channel.kt

+7-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ import kotlin.jvm.*
2323
*/
2424
public interface SendChannel<in E> {
2525
/**
26-
* Returns `true` if this channel was closed by an invocation of [close]. This means that
27-
* calling [send] will result in an exception.
26+
* Returns `true` if this channel was closed by an invocation of [close] or its receiving side was [cancelled][ReceiveChannel.cancel].
27+
* This means that calling [send] will result in an exception.
2828
*
29-
* **Note: This is an experimental api.** This property may change its semantics and/or name in the future.
29+
* Note that if this property returns `false`, it does not guarantee that consecutive call [send] will succeed, as the
30+
* channel can be concurrently closed right after the check. For such scenarios, it is recommended to use [trySend] instead.
31+
*
32+
* @see SendChannel.close
33+
* @see ReceiveChannel.cancel
3034
*/
31-
@ExperimentalCoroutinesApi
3235
public val isClosedForSend: Boolean
3336

3437
/**

0 commit comments

Comments
 (0)