# androidx.concurrent.futures

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/CallbackToFutureAdapter.Resolver` | This interface should be implemented by the object passed into `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/CallbackToFutureAdapter#getFuture(androidx.concurrent.futures.CallbackToFutureAdapter.Resolver<T>)`. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/CallbackToFutureAdapter` | A utility useful for adapting interfaces that take callbacks into interfaces that return `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html`. |
| `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/CallbackToFutureAdapter.Completer` | Used to complete the future returned by `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/CallbackToFutureAdapter#getFuture(androidx.concurrent.futures.CallbackToFutureAdapter.Resolver<T>)` |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/SuspendToFutureAdapter` | A utility for launching suspending calls scoped and managed by a returned `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html`, used for adapting Kotlin suspending APIs to be callable from the Java programming language. |

## Extension functions summary

|---|---|
| `suspend T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<T>.https://developer.android.com/reference/kotlin/androidx/concurrent/futures/package-summary#(com.google.common.util.concurrent.ListenableFuture).await()()` Awaits completion of `this` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` without blocking a thread. |

## Extension functions

### ListenableFuture.await

Artifact: [androidx.concurrent:concurrent-futures](https://developer.android.com/jetpack/androidx/releases/concurrent) [View Source](https://cs.android.com/search?q=file:androidx/concurrent/futures/ListenableFuture.kt+function:await)

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

Awaits completion of `this` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` without blocking a thread.

This suspend function is cancellable.

If the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/index.html` 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 `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-cancellation-exception/index.html`.

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 `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-non-cancellable/index.html`.