-
#include "tensorstore/util/future.h"
-
template <typename PromiseValue, typename FutureValue>
FutureCallbackRegistration
tensorstore::LinkResult(Promise<PromiseValue> promise,
Future<FutureValue> future); Creates a Link that moves a single Future’s result to a Promise.
While this link remains in effect, invokes:
promise.SetResult(future.result())
whenfuture
becomes ready. Iffuture.ready()
is true upon invocation of this function,promise.SetResult(future.result())
will be invoked from the current thread before this function returns.Additionally, forcing the future associated with
promise
will result in thefuture
object being forced.If
promise.result_needed()
becomesfalse
, the link is automatically removed.- Parameters:¶
- Promise<PromiseValue> promise¶
The promise to be linked.
- Future<FutureValue> future¶
The future to be linked.
- Returns:¶
A handle that can be used to remove this link.