public class DelayKt
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
delay(int time,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Delays coroutine for a given time without blocking a thread and resumes it after a specified time.
This suspending function is cancellable.
If the
interface Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function
immediately resumes with CancellationException. |
static java.lang.Object |
delay(long time,
java.util.concurrent.TimeUnit unit,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Delays coroutine for a given time without blocking a thread and resumes it after a specified time.
This suspending function is cancellable.
If the
interface Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function
immediately resumes with CancellationException. |
public static java.lang.Object delay(int time, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Delays coroutine for a given time without blocking a thread and resumes it after a specified time.
This suspending function is cancellable.
If the interface 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 SelectBuilder.onTimeout
clause.
This function delegates to Delay.scheduleResumeAfterDelay
if the context class CoroutineDispatcher
implements interface Delay
interface, otherwise it resumes using a built-in single-threaded scheduled executor service.
time
- time in milliseconds.interface Job
,
SelectBuilder.onTimeout
,
Delay.scheduleResumeAfterDelay
,
class CoroutineDispatcher
,
interface Delay
public static java.lang.Object delay(long time, java.util.concurrent.TimeUnit unit, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Delays coroutine for a given time without blocking a thread and resumes it after a specified time.
This suspending function is cancellable.
If the interface 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 SelectBuilder.onTimeout
clause.
This function delegates to Delay.scheduleResumeAfterDelay
if the context class CoroutineDispatcher
implements interface Delay
interface, otherwise it resumes using a built-in single-threaded scheduled executor service.
time
- time in the specified unit.unit
- time unit.interface Job
,
SelectBuilder.onTimeout
,
Delay.scheduleResumeAfterDelay
,
class CoroutineDispatcher
,
interface Delay