Future

A Future defers the resolution of a value to the future. The value can be consumed by calling Future.await method which is expected to block the current thread. Therefore, never call Future.await on the same thread as it will result in a dead lock.

interface Future<T>

Functions

await
Link copied to clipboard
common

Consume the future value in code as input. This method may or may not block the calling thread depending upon the implementation.

Examples

val future: Future<T> = // some api which returns a Future<T>
val value: R = future.await() // blocks until future completes

abstract fun await(): T
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

isCompleted
Link copied to clipboard
common

Returns true if the future has completed and is ready to await.

abstract var isCompleted: Boolean

Inheritors

JobFuture
Link copied to clipboard
common
ValueFuture
Link copied to clipboard
common
NativeFuture
Link copied to clipboard
DeferredFuture
Link copied to clipboard
ios