delay
Delays coroutine for a given time without blocking a thread and resumes it after a specified time. This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException.
Note, that delay can be used in select invocation with onTimeout clause.
This function delegates to Delay.scheduleResumeAfterDelay if the context CoroutineDispatcher implements Delay interface, otherwise it resumes using a built-in single-threaded scheduled executor service.
Parameters
time
- time in milliseconds.
Platform and version requirements: JVM
Delays coroutine for a given time without blocking a thread and resumes it after a specified time. This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException.
Note, that delay can be used in select invocation with onTimeout clause.
This function delegates to Delay.scheduleResumeAfterDelay if the context CoroutineDispatcher implements Delay interface, otherwise it resumes using a built-in single-threaded scheduled executor service.
Parameters
time
- time in the specified unit.
unit
- time unit.