CoroutineQueue

class CoroutineQueue(dispatcher: CoroutineDispatcher = Dispatchers.Main)

CoroutineScope-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.

Constructors

Link copied to clipboard
constructor(dispatcher: CoroutineDispatcher = Dispatchers.Main)

Functions

Link copied to clipboard
fun <T> async(block: suspend () -> T): Deferred<T>

Creates a coroutine in the queue and returns its future result as an implementation of Deferred.

Link copied to clipboard
suspend fun <T> await(block: suspend () -> T): T

Launches a coroutine in the queue, and waits for its result.

Link copied to clipboard
fun cancel(cause: CancellationException? = null)

Cancels this coroutine queue, including all its children with an optional cancellation cause.

Link copied to clipboard
fun launch(block: suspend () -> Unit)

Launches a coroutine in the queue.