Channel

fun <E> Channel(capacity: Int = RENDEZVOUS, onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND, onUndeliveredElement: (E) -> Unit? = null): Channel<E>

Creates a channel with the specified buffer capacity (or without a buffer by default). See Channel interface documentation for details.

Parameters

capacity

either a positive channel capacity or one of the constants defined in Channel.Factory.

onBufferOverflow

configures an action on buffer overflow (optional, defaults to a suspending attempt to send a value, supported only when capacity >= 0 or capacity == Channel.BUFFERED, implicitly creates a channel with at least one buffered element).

onUndeliveredElement

an optional function that is called when element was sent but was not delivered to the consumer. See "Undelivered elements" section in Channel documentation.

Throws


fun <E> Channel(capacity: Int = RENDEZVOUS): Channel<E>