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

Registers a callback to be invoked when result_needed() becomes false.

If result_needed() is false upon invocation, the callback is executed immediately.

Parameters:
Callback &&callback

A function object to be invoked with no arguments. 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 cancels pending work when invoked.