Package-level declarations
Channels — non-blocking primitives for communicating a stream of elements between coroutines.
Channels — non-blocking primitives for communicating a stream of elements between coroutines.
Channels — non-blocking primitives for communicating a stream of elements between coroutines.
Types
Scope for actor coroutine builder.
Channel is a non-blocking primitive for communication between a sender (via SendChannel) and a receiver (via ReceiveChannel). Conceptually, a channel is similar to Java's java.util.concurrent.BlockingQueue, but it has suspending operations instead of blocking ones and can be closed.
Iterator for ReceiveChannel. Instances of this interface are not thread-safe and shall not be used from concurrent coroutines.
A discriminated union of channel operation result. It encapsulates the successful or failed result of a channel operation or a failed operation to a closed channel with an optional cause.
Indicates an attempt to receive from a isClosedForReceive channel that was closed without a cause. A failed channel rethrows the original close cause exception on receive attempts.
Indicates an attempt to send to a isClosedForSend channel that was closed without a cause. A failed channel rethrows the original close cause exception on send attempts.
Scope for the produce, callbackFlow and channelFlow builders.
Receiver's interface to Channel.
Sender's interface to Channel.
Mode for ticker function.
Functions
Launches new coroutine that is receiving messages from its mailbox channel and returns a reference to its mailbox channel as a SendChannel. The resulting object can be used to send messages to this coroutine.
Opens subscription to this BroadcastChannel and makes sure that the given block consumes all elements from it by always invoking cancel after the execution of the block.
Subscribes to this BroadcastChannel and performs the specified action for each received element.
Performs the given action on the encapsulated Throwable exception if this instance represents failure due to channel being closed. The result of ChannelResult.exceptionOrNull is passed to the action parameter. It is guaranteed that if action is invoked, then the channel is either closed for send or is closed for receive depending on the failed operation.
Performs the given action on the encapsulated Throwable exception if this instance represents failure. The result of ChannelResult.exceptionOrNull is passed to the action parameter.
Launches a new coroutine to produce a stream of values by sending them to a channel and returns a reference to the coroutine as a ReceiveChannel. This resulting object can be used to receive elements produced by this coroutine.
Creates a channel that produces the first item after the given initial delay and subsequent items with the given delay between them.
Adds element 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.