androidx.concurrent.futures

Interfaces

CallbackToFutureAdapter.Resolver

This interface should be implemented by the object passed into getFuture.

Classes

CallbackToFutureAdapter

A utility useful for adapting interfaces that take callbacks into interfaces that return .

CallbackToFutureAdapter.Completer

Used to complete the future returned by getFuture

Objects

SuspendToFutureAdapter

A utility for launching suspending calls scoped and managed by a returned ListenableFuture, used for adapting Kotlin suspending APIs to be callable from the Java programming language.

Extension functions summary

suspend T
<T : Any?> ListenableFuture<T>.await()

Awaits completion of this ListenableFuture without blocking a thread.

Extension functions

suspend fun <T : Any?> ListenableFuture<T>.await(): T

Awaits completion of this ListenableFuture without blocking a thread.

This suspend function is cancellable.

If the kotlinx.coroutines.Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function stops waiting for the future and immediately resumes with CancellationException.

This method is intended to be used with one-shot Futures, so on coroutine cancellation, the Future is cancelled as well. If cancelling the given future is undesired, use kotlinx.coroutines.NonCancellable.