is Closed For Send
当前通道是否已关闭发送端。
返回
true表示后续任何send/trySend都会失败:send会抛出 ClosedSendChannelException;trySend会返回 ChannelResult.closed。返回
false不保证下一次send一定成功—— 通道可能在检查之后、真正发送之前被并发关闭; 若需强一致性,请使用 trySend 并根据其返回结果判断。
典型用途:
提前跳过昂贵计算:
if (channel.isClosedForSend) return
val expensive = compute()
channel.send(expensive) // 仍可能失败,但已尽量避免无用计算Content copied to clipboard
断言与日志诊断。