class EE::CancellationRegistration¶
Overview¶
RAII handle for a callback registered on a CancellationToken. More…
#include <cancellationtoken.hpp> class CancellationRegistration { public: // construction CancellationRegistration(); CancellationRegistration(CancellationRegistration&& other); CancellationRegistration(const CancellationRegistration&); ~CancellationRegistration(); // methods CancellationRegistration& operator=(CancellationRegistration&& other); CancellationRegistration& operator=(const CancellationRegistration&); void reset(); operator bool() const; };
Detailed Documentation¶
RAII handle for a callback registered on a CancellationToken.
Destroying (or reset() -ing) the registration unregisters the callback if it has not fired. If the callback is running concurrently on the cancelling thread, destruction waits for it to finish, so state captured by the callback may be released right after the registration dies. A callback may destroy its own registration without deadlocking.
Methods¶
void reset()
Unregisters the callback now.
operator bool() const
Returns:
True while the callback is registered and has not been invoked.