Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::thread_error_category Class Reference

std::error_category implementation for thread_system errors More...

#include <error_handling.h>

Inheritance diagram for kcenon::thread::thread_error_category:
Inheritance graph
Collaboration diagram for kcenon::thread::thread_error_category:
Collaboration graph

Public Member Functions

const char * name () const noexcept override
 Returns the name of the error category.
 
std::string message (int ev) const override
 Returns a message for the given error code.
 
bool equivalent (int ev, const std::error_condition &condition) const noexcept override
 Returns the equivalent std::errc for certain error codes.
 

Detailed Description

std::error_category implementation for thread_system errors

This allows thread_system error_code to be used with std::error_code, enabling seamless integration with standard library error handling.

Definition at line 235 of file error_handling.h.

Member Function Documentation

◆ equivalent()

bool kcenon::thread::thread_error_category::equivalent ( int ev,
const std::error_condition & condition ) const
inlinenodiscardoverridenoexcept

Returns the equivalent std::errc for certain error codes.

Parameters
evThe error value
conditionThe std::error_condition to compare against
Returns
true if the error is equivalent to the condition

Definition at line 259 of file error_handling.h.

259 {
260 switch (static_cast<error_code>(ev)) {
262 return condition == std::errc::invalid_argument;
265 return condition == std::errc::not_enough_memory;
267 return condition == std::errc::timed_out;
269 return condition == std::errc::resource_deadlock_would_occur;
270 default:
271 return false;
272 }
273 }
error_code
Strongly typed error codes for thread system operations.

References kcenon::thread::deadlock_detected, kcenon::thread::invalid_argument, kcenon::thread::operation_timeout, kcenon::thread::resource_allocation_failed, and kcenon::thread::resource_limit_reached.

◆ message()

std::string kcenon::thread::thread_error_category::message ( int ev) const
inlinenodiscardoverride

Returns a message for the given error code.

Parameters
evThe error value
Returns
Human-readable error message

Definition at line 249 of file error_handling.h.

249 {
250 return error_code_to_string(static_cast<error_code>(ev));
251 }
std::string error_code_to_string(error_code code)
Converts an error_code to a string representation.

References kcenon::thread::error_code_to_string().

Here is the call graph for this function:

◆ name()

const char * kcenon::thread::thread_error_category::name ( ) const
inlinenodiscardoverridenoexcept

Returns the name of the error category.

Definition at line 240 of file error_handling.h.

240 {
241 return "thread_system";
242 }

The documentation for this class was generated from the following file: