suspendCoroutineWithTimeout

inline suspend fun <T> suspendCoroutineWithTimeout(timeout: Duration, crossinline block: (Continuation<T>) -> Unit): T

Suspends the current coroutine until the specified block is completed or the timeout is reached.

Return

The result of the block.

Parameters

timeout

The duration to wait for the block to complete.

block

The block to execute.


inline suspend fun <T> suspendCoroutineWithTimeout(timeMillis: Long, crossinline block: (CancellableContinuation<T>) -> Unit): T

Suspends the current coroutine until the specified block is completed or the timeout is reached.

Return

The result of the block.

Parameters

timeMillis

The time in milliseconds to wait for the block to complete.

block

The block to execute.