ThreadSchedule 1.0.0
Modern C++ thread management library
|
High-performance thread pool with built-in error handling. 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 | distribute_across_cpus () -> expected< void, std::error_code > |
Distribute threads across CPUs. | |
void | shutdown () |
Shutdown the pool. | |
void | wait_for_tasks () |
Wait for all tasks to complete. | |
auto | size () const noexcept -> size_t |
Get pool size. | |
auto | pending_tasks () const -> size_t |
Get pending task count. |
High-performance thread pool with built-in error handling.
Extends HighPerformancePool with automatic exception catching and error callbacks.
Definition at line 15 of file thread_pool_with_errors.hpp.
|
inlineexplicit |
Definition at line 18 of file thread_pool_with_errors.hpp.
|
inline |
Add a global error callback for all tasks.
Definition at line 83 of file thread_pool_with_errors.hpp.
|
inline |
Clear all error callbacks.
Definition at line 91 of file thread_pool_with_errors.hpp.
|
inline |
Configure threads.
Definition at line 131 of file thread_pool_with_errors.hpp.
|
inline |
Distribute threads across CPUs.
Definition at line 140 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get total error count.
Definition at line 99 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get statistics from underlying pool.
Definition at line 123 of file thread_pool_with_errors.hpp.
References threadschedule::HighPerformancePool::get_statistics().
|
inlinenodiscard |
Get pending task count.
Definition at line 172 of file thread_pool_with_errors.hpp.
|
inlinenodiscard |
Get the underlying pool.
Definition at line 115 of file thread_pool_with_errors.hpp.
|
inline |
Reset error count.
Definition at line 107 of file thread_pool_with_errors.hpp.
|
inline |
Shutdown the pool.
Definition at line 148 of file thread_pool_with_errors.hpp.
|
inlinenodiscardnoexcept |
Get pool size.
Definition at line 164 of file thread_pool_with_errors.hpp.
|
inline |
Submit a task with automatic error handling.
Definition at line 27 of file thread_pool_with_errors.hpp.
|
inline |
Submit a task with a description for better error messages.
Definition at line 54 of file thread_pool_with_errors.hpp.
|
inline |
Wait for all tasks to complete.
Definition at line 156 of file thread_pool_with_errors.hpp.