-
#include "tensorstore/util/future.h"
- class tensorstore::FutureCallbackRegistration;
Handle to a registered Future or Promise callback, that may be used to unregister it.
This type has shared weak ownership semantics, and may be copied to create an equivalent handle, either of which may be used to unregister the callback.
A handle may be either live, meaning it refers to a callback, or null. Live handles to a callback prevent its memory from being freed, even after it has finished running or been unregistered using a different handle, but live handles do not prevent the destructors of callback function objects from running.
Move construction and move assignment leave the moved-from handle in the null state.
- threadsafety Multiple handle objects referring to the same callback may
safely be used concurrently from multiple threads, but non-
const
methods of the same handle object must not be called concurrently from multiple threads.
Constructors¶
- FutureCallbackRegistration();
Constructs a null handle.
Methods¶
- void Unregister() noexcept;
Unregisters the associated callback.
- void UnregisterNonBlocking() noexcept;
Same as
Unregister
, except that in the case that the callback is executing concurrently in another thread, this method does not block until it completes.
- void operator()() noexcept;
Equivalent to
Unregister()
.