#include "tensorstore/util/future.h"
template <typename Callback>
FutureCallbackRegistration
tensorstore::Promise<T>::ExecuteWhenForced(Callback&callback) const;

Registers a callback to be invoked when Future::Force is called on an associated Future.

If Future::Force has already been called, the callback is invoked immediately.

Parameters:
Callback &&callback

A function object to be invoked with a copy of *this. The return value of the callback is ignored.

Returns:

A handle that may be used to unregister the callback.

Note

Typically, the specified callback function starts deferred work that ultimately leads to the result being set.