Package-level declarations

Functions

Link copied to clipboard

Converts this task to an instance of Deferred. If task is cancelled then resulting deferred will be cancelled as well. However, the opposite is not true: if the deferred is cancelled, the Task will not be cancelled. For bi-directional cancellation, an overload that accepts CancellationTokenSource can be used.

Converts this task to an instance of Deferred with a CancellationTokenSource to control cancellation. The cancellation of this function is bi-directional:

Link copied to clipboard
fun <T> Deferred<T>.asTask(): Task<T>

Converts this deferred to the instance of Task. If deferred is cancelled then resulting task will be cancelled as well.

Link copied to clipboard
suspend fun <T> Task<T>.await(): T

Awaits the completion of the task without blocking a thread.

suspend fun <T> Task<T>.await(cancellationTokenSource: CancellationTokenSource): T

Awaits the completion of the task that is linked to the given CancellationTokenSource to control cancellation.