class EE::detail::CancellationState

Overview

Shared cancellation state. More…

#include <cancellationtoken.hpp>

class CancellationState {
public:
    // typedefs

    typedef SmallUniqueFunction<void(), 64> Callback;

    // structs

    struct Entry;

    // methods

    bool isCancellationRequested() const;
    bool cancel();
    Uint64 add(Callback& callback);
    void remove(Uint64 id);
};

Detailed Documentation

Shared cancellation state. Owned jointly by the source, tokens and live registrations.

Methods

Uint64 add(Callback& callback)

Returns:

Registration id, or 0 when cancellation already happened (callback not stored).

void remove(Uint64 id)

Removes the registration. Blocks while its callback is running on another thread.