Package kotlinx.coroutines.selects

Select expression to perform multiple suspending operations simultaneously until one of them succeeds.

Types

SelectBuilder
Link copied to clipboard
common
interface SelectBuilder<in R>
Scope for select invocation.
SelectClause0
Link copied to clipboard
common
interface SelectClause0
Clause for select expression without additional parameters that does not select any value.
SelectClause1
Link copied to clipboard
common
interface SelectClause1<out Q>
Clause for select expression without additional parameters that selects value of type Q.
SelectClause2
Link copied to clipboard
common
interface SelectClause2<in P, out Q>
Clause for select expression with additional parameter of type P that selects value of type Q.

Functions

onTimeout
Link copied to clipboard
common
fun <R> SelectBuilder<R>.onTimeout(timeout: Duration, block: suspend () -> R)
Clause that selects the given block after the specified timeout passes.
select
Link copied to clipboard
common
inline suspend fun <R> select(crossinline builder: SelectBuilder<R>.() -> Unit): R
Waits for the result of multiple suspending functions simultaneously, which are specified using clauses in the builder scope of this select invocation.
selectUnbiased
Link copied to clipboard
common
inline suspend fun <R> selectUnbiased(crossinline builder: SelectBuilder<R>.() -> Unit): R
Waits for the result of multiple suspending functions simultaneously like select, but in an unbiased way when multiple clauses are selectable at the same time.
whileSelect
Link copied to clipboard
common
inline suspend fun whileSelect(crossinline builder: SelectBuilder<Boolean>.() -> Unit)
Loops while select expression returns true.