CoroutineStart
enum class CoroutineStart
(source)Defines start option for coroutines builders.
It is used in start
parameter of launch, async, and other coroutine builder functions.
The summary of coroutine start options is:
- DEFAULT – immediately schedules coroutine for execution according to its context;
- LAZY – starts coroutine lazily, only when it is needed;
- ATOMIC – atomically (in a non-cancellable way) schedules coroutine for execution according to its context;
- UNDISPATCHED – immediately executes coroutine until its first suspension point in the current thread.
Enum Values
Default – immediately schedules coroutine for execution according to its context. |
|
Starts coroutine lazily, only when it is needed. |
|
Atomically (in non-cancellable way) schedules coroutine for execution according to its context. This is similar to DEFAULT, but the coroutine cannot be cancelled before it starts executing. |
|
Immediately executes coroutine until its first suspension point in the current thread as if it the coroutine was started using Unconfined dispatcher. However, when coroutine is resumed from suspension it is dispatched according to the CoroutineDispatcher in its context. |
Properties
val isLazy: Boolean Returns |
Functions
operator fun <T> invoke( Starts the corresponding block as a coroutine with this coroutine start strategy. operator fun <R, T> invoke( Starts the corresponding block with receiver as a coroutine with this coroutine start strategy. |