#include <userver/engine/task/cancel.hpp>
Cancellation token to given task object.
Unlike Task, TaskCancellationToken object doesn't wait for task finish in its destructor. It is allowed to outlive the task object it was created from. However, as long as there is any cancellation token associated with given task, some internal structures of a task will not be freed.
General rule: whenever possible, prefer using engine::Task object instead.
Definition at line 99 of file cancel.hpp.
Public Member Functions | |
TaskCancellationToken () noexcept | |
Creates an invalid TaskCancellationToken. | |
TaskCancellationToken (Task &task) | |
TaskCancellationToken (const TaskCancellationToken &) noexcept | |
TaskCancellationToken (TaskCancellationToken &&) noexcept | |
TaskCancellationToken & | operator= (const TaskCancellationToken &) noexcept |
TaskCancellationToken & | operator= (TaskCancellationToken &&) noexcept |
void | RequestCancel () |
bool | IsValid () const noexcept |
True if this token is associated with a task. | |
|
explicit |
Creates a TaskCancellationToken associated with a task. The task must be valid.
void engine::TaskCancellationToken::RequestCancel | ( | ) |