class EE::CancellationSource

Overview

Producer side of a cancellation request. More…

#include <cancellationtoken.hpp>

class CancellationSource {
public:
    // construction

    CancellationSource();
    CancellationSource(CancellationSource&&);
    CancellationSource(const CancellationSource&);

    // methods

    CancellationSource& operator=(CancellationSource&&);
    CancellationSource& operator=(const CancellationSource&);
    CancellationToken token() const;
    bool cancel();
    bool isCancellationRequested() const;
};

Detailed Documentation

Producer side of a cancellation request.

Move-only. Destroying the source does not cancel its tokens.

Methods

bool cancel()

Requests cancellation and runs every registered callback on this thread.

Returns:

True only for the call that performed the cancellation.