SendChannel

interface SendChannel<in E>

Sender's interface to Channel.

Functions

close
Link copied to clipboard
common
abstract fun close(cause: Throwable? = null): Boolean
Closes this channel.
invokeOnClose
Link copied to clipboard
common
abstract fun invokeOnClose(handler: (cause: Throwable?) -> Unit)
Registers a handler which is synchronously invoked once the channel is closed or the receiving side of this channel is cancelled.
send
Link copied to clipboard
common
abstract suspend fun send(element: E)
Sends the specified element to this channel, suspending the caller while the buffer of this channel is full or if it does not exist, or throws an exception if the channel is closed for send (see close for details).
trySend
Link copied to clipboard
common
abstract fun trySend(element: E): ChannelResult<Unit>
Immediately adds the specified element to this channel, if this doesn't violate its capacity restrictions, and returns the successful result.

Properties

isClosedForSend
Link copied to clipboard
common
abstract val isClosedForSend: Boolean
Returns true if this channel was closed by an invocation of close.
onSend
Link copied to clipboard
common
abstract val onSend: SelectClause2<E, SendChannel<E>>
Clause for the select expression of the send suspending function that selects when the element that is specified as the parameter is sent to the channel.

Inheritors

BroadcastChannel
Link copied to clipboard
Channel
Link copied to clipboard
ProducerScope
Link copied to clipboard

Extensions

sendBlocking
Link copied to clipboard
fun <E> SendChannel<E>.sendBlocking(element: E)
Deprecated blocking variant of send.
trySendBlocking
Link copied to clipboard
fun <E> SendChannel<E>.trySendBlocking(element: E): ChannelResult<Unit>
Adds element into to this channel, blocking the caller while this channel is full, and returning either successful result when the element was added, or failed result representing closed channel with a corresponding exception.

Sources

common source
Link copied to clipboard