#include "tensorstore/util/future.h"
class [[nodiscard]] tensorstore::AnyFuture;

Generic consumer interface to a one-time channel.

Constructors

explicit AnyFuture();

Constructs an null AnyFuture. :post: null().

Methods

void IgnoreFuture() const;

Ignores the future. This method signals intent to ignore the result to suppress compiler warnings from [[nodiscard]].

void reset() noexcept;

Resets this Future to be null.

bool null() const noexcept;

Returns true if this Future has no shared state.

bool ready() const noexcept;

Returns true if the result is ready.

void Wait() const noexcept;

Calls Force(), and waits until ready() == true.

bool WaitFor(absl::Duration duration) const noexcept;

Waits for up to the specified duration for the result to be ready.

bool WaitUntil(absl::Time deadline) const noexcept;

Waits until the specified time for the result to be ready.

void Force() const noexcept;

Calls any Force callbacks registered on the associated Promise, if they have not already been called.

const absl::Statusstatus() const& noexcept;

Calls Force(), waits for the result to be ready, and returns OkStatus (when a value is present) or a copy of result.status().

FutureCallbackRegistration
UntypedExecuteWhenReady(Callback&callback);

Executes callback with the signature void(AnyFuture) when this becomes ready.

bool tensorstore::HaveSameSharedState(const AnyFuturea,
                                      
const AnyFutureb);

Returns true if both futures refer to the same shared state, or are both null.

absl::Status tensorstore::GetStatus(const AnyFuturefuture);

Waits for the future to be ready and returns the status.