Namespace with functions to work with current task from within it.
Functions | |
bool | IsCancelRequested () noexcept |
bool | ShouldCancel () noexcept |
TaskCancellationReason | CancellationReason () noexcept |
void | CancellationPoint () |
Throws an exception if a cancellation request for this task is pending. | |
void | SetDeadline (Deadline deadline) |
TaskCancellationToken | GetCancellationToken () |
Return cancellation token for current coroutine. | |
bool | IsTaskProcessorThread () noexcept |
TaskProcessor & | GetTaskProcessor () |
Returns reference to the task processor executing the caller. | |
std::size_t | GetStackSize () |
Returns task coroutine stack size. | |
void engine::current_task::CancellationPoint | ( | ) |
Throws an exception if a cancellation request for this task is pending.
unspecified | (non-std) exception if cancellation is pending and not blocked |
|
noexcept |
Returns task cancellation reason for the current task
|
noexcept |
Checks for pending cancellation requests, use engine::current_task::ShouldCancel() instead, as the latter respects engine::TaskCancellationBlocker.
|
noexcept |
Returns true only when running in userver coroutine environment, i.e. in an engine::TaskProcessor thread.
void engine::current_task::SetDeadline | ( | Deadline | deadline | ) |
Set deadline for the current task. The task will be cancelled when the deadline is reached.
|
noexcept |
Checks for pending non-blocked cancellation requests