-
public final class CoroutineQueueCoroutineScope-like util to execute coroutines in a sequential order (FIFO). As with a SupervisorJob, children can be cancelled or fail independently one from the other.
-
-
Constructor Summary
Constructors Constructor Description CoroutineQueue(CoroutineDispatcher dispatcher)
-
Method Summary
Modifier and Type Method Description final Unitlaunch(SuspendFunction0<Unit> block)Launches a coroutine in the queue. final <T extends Any> Deferred<T>async(SuspendFunction0<T> block)Creates a coroutine in the queue and returns its future result as an implementation of Deferred. final <T extends Any> Tawait(SuspendFunction0<T> block)Launches a coroutine in the queue, and waits for its result. final Unit)>cancel(<ERROR CLASS> cause)Cancels this coroutine queue, including all its children with an optional cancellation cause. -
-
Method Detail
-
launch
final Unit launch(SuspendFunction0<Unit> block)
Launches a coroutine in the queue.
Exceptions thrown by block will be ignored.
-
async
final <T extends Any> Deferred<T> async(SuspendFunction0<T> block)
Creates a coroutine in the queue and returns its future result as an implementation of Deferred.
Exceptions thrown by block will be caught and represented in the resulting Deferred.
-
await
final <T extends Any> T await(SuspendFunction0<T> block)
Launches a coroutine in the queue, and waits for its result.
Exceptions thrown by block will be rethrown.
-
-
-
-