Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
error_handling.h File Reference

Modern error handling for the thread system. More...

#include <string>
#include <optional>
#include <type_traits>
#include <string_view>
#include <ostream>
#include <functional>
#include <stdexcept>
Include dependency graph for error_handling.h:

Go to the source code of this file.

Classes

class  kcenon::thread::error
 Represents an error in the thread system. More...
 
class  kcenon::thread::result_void
 Wrapper for void result. More...
 
class  kcenon::thread::result< T >
 A template class representing either a value or an error. More...
 
class  kcenon::thread::result< void >
 Specialization of result for void. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::thread
 Core threading foundation of the thread system library.
 

Typedefs

template<typename T >
using kcenon::thread::result_t = result<T>
 

Enumerations

enum class  kcenon::thread::error_code {
  kcenon::thread::success = 0 , kcenon::thread::unknown_error = -101 , kcenon::thread::operation_canceled = -102 , kcenon::thread::operation_timeout = -103 ,
  kcenon::thread::not_implemented = -104 , kcenon::thread::invalid_argument = -105 , kcenon::thread::thread_already_running = -110 , kcenon::thread::thread_not_running = -111 ,
  kcenon::thread::thread_start_failure = -112 , kcenon::thread::thread_join_failure = -113 , kcenon::thread::queue_full = -120 , kcenon::thread::queue_empty = -121 ,
  kcenon::thread::queue_stopped = -122 , kcenon::thread::queue_busy = -123 , kcenon::thread::job_creation_failed = -130 , kcenon::thread::job_execution_failed = -131 ,
  kcenon::thread::job_invalid = -132 , kcenon::thread::resource_allocation_failed = -140 , kcenon::thread::resource_limit_reached = -141 , kcenon::thread::mutex_error = -150 ,
  kcenon::thread::deadlock_detected = -151 , kcenon::thread::condition_variable_error = -152 , kcenon::thread::io_error = -160 , kcenon::thread::file_not_found = -161 ,
  kcenon::thread::success = 0 , kcenon::thread::unknown_error = -101 , kcenon::thread::operation_canceled = -102 , kcenon::thread::operation_timeout = -103 ,
  kcenon::thread::not_implemented = -104 , kcenon::thread::invalid_argument = -105 , kcenon::thread::thread_already_running = -110 , kcenon::thread::thread_not_running = -111 ,
  kcenon::thread::thread_start_failure = -112 , kcenon::thread::thread_join_failure = -113 , kcenon::thread::queue_full = -120 , kcenon::thread::queue_empty = -121 ,
  kcenon::thread::queue_stopped = -122 , kcenon::thread::queue_busy = -123 , kcenon::thread::job_creation_failed = -130 , kcenon::thread::job_execution_failed = -131 ,
  kcenon::thread::job_invalid = -132 , kcenon::thread::resource_allocation_failed = -140 , kcenon::thread::resource_limit_reached = -141 , kcenon::thread::mutex_error = -150 ,
  kcenon::thread::deadlock_detected = -151 , kcenon::thread::condition_variable_error = -152 , kcenon::thread::io_error = -160 , kcenon::thread::file_not_found = -161 ,
  kcenon::thread::circuit_open = -170 , kcenon::thread::circuit_half_open = -171
}
 Strongly typed error codes for thread system operations. More...
 

Functions

std::string kcenon::thread::error_code_to_string (error_code code)
 Converts an error_code to a string representation.
 
template<typename T >
result< T > kcenon::thread::optional_error_to_result (const std::optional< std::string > &error, T &&value)
 
result< void > kcenon::thread::optional_error_to_result (const std::optional< std::string > &error)
 
std::optional< std::string > kcenon::thread::result_to_optional_error (const result< void > &res)
 
template<typename T >
std::pair< std::optional< T >, std::optional< std::string > > kcenon::thread::result_to_pair (const result< T > &res)
 

Detailed Description

Modern error handling for the thread system.

This file provides typed error handling capabilities using a result type pattern that is similar to std::expected from C++23, but can be used with C++20.

Definition in file error_handling.h.