TFuture

Represents an operation which is executed asynchronously and the result of which will become available at some point in the future.

Once a operation is completed, the result of the operation can be fetched via the get() family of methods. There are three possible cases: Either the operation succeeded, then its return value is returned, or it failed by throwing, in which case the exception is rethrown, or it was cancelled before, then a TCancelledException is thrown. There might be TFuture implementations which never possibly enter the cancelled state.

All methods are thread-safe, but keep in mind that any exception object or result (if it is a reference type, of course) is shared between all get()-family invocations.

Alias This

waitGetProperty

Members

Functions

completion
TAwaitable completion()

A TAwaitable triggered when the operation leaves the RUNNING status.

get
ResultType get()

Returns the result of the operation.

getException
Exception getException()

Returns the captured exception if the operation failed, or null otherwise.

status
TFutureStatus status()

The status the operation is currently in.

waitGet
ResultType waitGet()

Convenience shorthand for waiting until the result is available and then get()ing it.

waitGet
ResultType waitGet(Duration timeout)

Convenience shorthand for waiting until the result is available and then get()ing it.

Properties

waitGetProperty
auto waitGetProperty [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta