92 type_str =
"user_requested";
98 type_str =
"deadline";
101 type_str =
"parent_cancelled";
104 type_str =
"pool_shutdown";
111 std::string
result =
"cancellation_reason{type=" + type_str;
132 return "user_requested";
138 return "parent_cancelled";
140 return "pool_shutdown";
Represents an error in the thread system.
A template class representing either a value or an error.
Core threading foundation of the thread system library.
Holds information about why a cancellation occurred.
static auto type_to_string(type t) -> std::string
Converts the reason type enum to a string.
std::chrono::steady_clock::time_point cancel_time
Time point when the cancellation occurred.
type reason_type
The type of cancellation that occurred.
auto to_string() const -> std::string
Converts the cancellation reason to a human-readable string.
std::optional< std::exception_ptr > exception
Optional exception that triggered the cancellation.
std::string message
Human-readable message describing the cancellation.
type
The type of cancellation that occurred.
@ pool_shutdown
Thread pool is shutting down.
@ parent_cancelled
Parent token was cancelled.
@ deadline
Deadline time point reached.
@ none
No cancellation (default state)
@ user_requested
Explicit cancel() call by user.
@ timeout
Timeout duration expired.
@ error
Cancellation triggered by an error.