Select expression to perform multiple suspending operations simultaneously until one of them succeeds.
This function specifies how the internal result, provided via SelectInstance.trySelect or SelectInstance.selectInRegistrationPhase, should be processed in case of this
select cancellation while dispatching. Unfortunately, we cannot pass this function only in SelectInstance.trySelect, as SelectInstance.selectInRegistrationPhase can be called when the coroutine is already cancelled.
This function specifies how the internal result, provided via SelectInstance.selectInRegistrationPhase or SelectInstance.trySelect should be processed. For example, both ReceiveChannel.onReceive and ReceiveChannel.onReceiveCatching clauses perform exactly the same synchronization logic, but differ when the channel has been discovered in the closed or cancelled state.
The registration function specifies how the
select instance should be registered into the specified clause object. In case of channels, the registration logic coincides with the plain
send/receive operation with the only difference that the
select instance is stored as a waiter instead of continuation.
Waits for the result of multiple suspending functions simultaneously, which are specified using clauses in the builder scope of this select invocation. The caller is suspended until one of the clauses is either selected or fails.