|
ThreadSchedule 1.0.0
Modern C++ thread management library
|
HighPerformancePool combined with an ErrorHandler. More...
#include <thread_pool_with_errors.hpp>
Public Member Functions | |
| HighPerformancePoolWithErrors (size_t num_threads=std::thread::hardware_concurrency()) | |
| template<typename F, typename... Args> | |
| auto | submit (F &&f, Args &&... args) -> FutureWithErrorHandler< std::invoke_result_t< F, Args... > > |
| Submit a task with automatic error handling. | |
| template<typename F, typename... Args> | |
| auto | submit_with_description (std::string const &description, F &&f, Args &&... args) -> FutureWithErrorHandler< std::invoke_result_t< F, Args... > > |
| Submit a task with a description for better error messages. | |
| auto | add_error_callback (ErrorCallback callback) -> size_t |
| Add a global error callback for all tasks. | |
| void | clear_error_callbacks () |
| Clear all error callbacks. | |
| auto | error_count () const -> size_t |
| Get total error count. | |
| void | reset_error_count () |
| Reset error count. | |
| auto | pool () -> HighPerformancePool & |
| Get the underlying pool. | |
| auto | get_statistics () const -> HighPerformancePool::Statistics |
| Get statistics from underlying pool. | |
| auto | configure_threads (std::string const &name_prefix, SchedulingPolicy policy=SchedulingPolicy::OTHER, ThreadPriority priority=ThreadPriority::normal()) -> expected< void, std::error_code > |
| Configure threads. | |
| auto | set_affinity (ThreadAffinity const &affinity) -> expected< void, std::error_code > |
| auto | distribute_across_cpus () -> expected< void, std::error_code > |
| void | shutdown () |
| void | wait_for_tasks () |
| auto | size () const noexcept -> size_t |
| auto | pending_tasks () const -> size_t |
HighPerformancePool combined with an ErrorHandler.
Non-copyable, non-movable. Thread-safe (delegates to the underlying HighPerformancePool).
submit() wraps every task so that exceptions are both reported to the ErrorHandler (via registered callbacks) and re-thrown, making them accessible through the returned FutureWithErrorHandler. submit_with_description() additionally attaches a user-supplied description string to the error report for easier diagnostics.
Definition at line 24 of file thread_pool_with_errors.hpp.
|
inlineexplicit |
Definition at line 27 of file thread_pool_with_errors.hpp.
|
inline |
Add a global error callback for all tasks.
Definition at line 92 of file thread_pool_with_errors.hpp.
|
inline |
Clear all error callbacks.
Definition at line 100 of file thread_pool_with_errors.hpp.
|
inline |
Configure threads.
Definition at line 140 of file thread_pool_with_errors.hpp.
|
inline |
Definition at line 151 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get total error count.
Definition at line 108 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get statistics from underlying pool.
Definition at line 132 of file thread_pool_with_errors.hpp.
References threadschedule::HighPerformancePool::get_statistics().
|
inlinenodiscard |
Definition at line 171 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get the underlying pool.
Definition at line 124 of file thread_pool_with_errors.hpp.
|
inline |
Reset error count.
Definition at line 116 of file thread_pool_with_errors.hpp.
|
inline |
Definition at line 146 of file thread_pool_with_errors.hpp.
|
inline |
Definition at line 156 of file thread_pool_with_errors.hpp.
|
inlinenodiscardnoexcept |
Definition at line 166 of file thread_pool_with_errors.hpp.
|
inline |
Submit a task with automatic error handling.
Definition at line 36 of file thread_pool_with_errors.hpp.
References threadschedule::TaskError::exception, threadschedule::TaskError::thread_id, and threadschedule::TaskError::timestamp.
|
inline |
Submit a task with a description for better error messages.
Definition at line 63 of file thread_pool_with_errors.hpp.
References threadschedule::TaskError::exception, threadschedule::TaskError::task_description, threadschedule::TaskError::thread_id, and threadschedule::TaskError::timestamp.
|
inline |
Definition at line 161 of file thread_pool_with_errors.hpp.