ProducerScope

interface ProducerScope<in E> : CoroutineScope, SendChannel<E>

Scope for the produce coroutine builder.

Note: This is an experimental api. Behavior of producers that work as children in a parent scope with respect to cancellation and error handling may change in the future.

Properties

channel
Link copied to clipboard
common
abstract val channel: SendChannel<E>
A reference to the channel this coroutine sends elements to.

Extensions

awaitClose
Link copied to clipboard
common
suspend fun ProducerScope<*>.awaitClose(block: () -> Unit = {})
Suspends the current coroutine until the channel is either closed or cancelled and invokes the given block before resuming the coroutine.

Sources

common source
Link copied to clipboard