A CancellationCallback object registers the callback with the specified CancellationToken such that the callback will be executed if the corresponding CancellationSource object has the requestCancellation() method called on it.

Synopsis

Declared in <folly/CancellationToken.h>

class CancellationCallback;

Description

If the CancellationToken object already had cancellation requested then the callback will be executed inline on the current thread before the constructor returns. Otherwise, the callback will be executed on in the execution context of the first thread to call requestCancellation() on a corresponding CancellationSource.

The callback object must not throw any unhandled exceptions. Doing so will result in the program terminating via std::terminate().

A CancellationCallback object is neither copyable nor movable.

refcode folly/docs/examples/folly/CancellationCallback.cpp

Member Functions

Name

Description

CancellationCallback [constructor]

Constructors

~CancellationCallback [destructor]

Deregisters the callback from the CancellationToken.

operator=

Assignment operators

Friends

Name

Description

folly::detail::CancellationState

Created with MrDocs