userver: userver/engine/task/cancel.hpp File Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
cancel.hpp File Reference

Detailed Description

Task cancellation helpers.

Definition in file cancel.hpp.

Go to the source code of this file.

#include <string>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <userver/engine/deadline.hpp>
+ Include dependency graph for cancel.hpp:
+ This graph shows which files directly or indirectly include this file:

Classes

class  engine::TaskCancellationBlocker
 
class  engine::TaskCancellationToken
 Cancellation token to given task object. More...
 

Namespaces

namespace  engine
 Asynchronous engine primitives.
 
namespace  engine::current_task
 Namespace with functions to work with current task from within it.
 

Enumerations

enum class  engine::TaskCancellationReason {
  engine::kNone ,
  engine::kUserRequest ,
  engine::kDeadline ,
  engine::kOverload ,
  engine::kAbandoned ,
  engine::kShutdown
}
 Task cancellation reason. More...
 

Functions

bool engine::current_task::IsCancelRequested () noexcept
 
bool engine::current_task::ShouldCancel () noexcept
 
TaskCancellationReason engine::current_task::CancellationReason () noexcept
 
void engine::current_task::CancellationPoint ()
 Throws an exception if a cancellation request for this task is pending.
 
void engine::current_task::SetDeadline (Deadline deadline)
 
TaskCancellationToken engine::current_task::GetCancellationToken ()
 Return cancellation token for current coroutine.
 
std::string_view engine::ToString (TaskCancellationReason reason) noexcept
 Returns a string representation of a cancellation reason.