ThreadSchedule 1.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::ThreadPoolWithErrors Class Reference

Simple thread pool with built-in error handling. More...

#include <thread_pool_with_errors.hpp>

Public Member Functions

 ThreadPoolWithErrors (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... > >
template<typename F, typename... Args>
auto submit_with_description (std::string const &description, F &&f, Args &&... args) -> FutureWithErrorHandler< std::invoke_result_t< F, Args... > >
auto add_error_callback (ErrorCallback callback) -> size_t
void clear_error_callbacks ()
auto error_count () const -> size_t
void reset_error_count ()
auto pool () -> ThreadPool &
auto get_statistics () const -> ThreadPool::Statistics
auto configure_threads (std::string const &name_prefix, SchedulingPolicy policy=SchedulingPolicy::OTHER, ThreadPriority priority=ThreadPriority::normal()) -> bool
auto set_affinity (ThreadAffinity const &affinity) -> bool
auto distribute_across_cpus () -> bool
void wait_for_tasks ()
void shutdown ()
auto size () const noexcept -> size_t
auto pending_tasks () const -> size_t

Detailed Description

Simple thread pool with built-in error handling.

Definition at line 308 of file thread_pool_with_errors.hpp.

Constructor & Destructor Documentation

◆ ThreadPoolWithErrors()

threadschedule::ThreadPoolWithErrors::ThreadPoolWithErrors ( size_t num_threads = std::thread::hardware_concurrency())
inlineexplicit

Definition at line 311 of file thread_pool_with_errors.hpp.

Member Function Documentation

◆ add_error_callback()

auto threadschedule::ThreadPoolWithErrors::add_error_callback ( ErrorCallback callback) -> size_t
inline

Definition at line 367 of file thread_pool_with_errors.hpp.

◆ clear_error_callbacks()

void threadschedule::ThreadPoolWithErrors::clear_error_callbacks ( )
inline

Definition at line 372 of file thread_pool_with_errors.hpp.

◆ configure_threads()

auto threadschedule::ThreadPoolWithErrors::configure_threads ( std::string const & name_prefix,
SchedulingPolicy policy = SchedulingPolicy::OTHER,
ThreadPriority priority = ThreadPriority::normal() ) -> bool
inline

Definition at line 397 of file thread_pool_with_errors.hpp.

◆ distribute_across_cpus()

auto threadschedule::ThreadPoolWithErrors::distribute_across_cpus ( ) -> bool
inline

Definition at line 408 of file thread_pool_with_errors.hpp.

◆ error_count()

auto threadschedule::ThreadPoolWithErrors::error_count ( ) const -> size_t
inlinenodiscard

Definition at line 377 of file thread_pool_with_errors.hpp.

◆ get_statistics()

auto threadschedule::ThreadPoolWithErrors::get_statistics ( ) const -> ThreadPool::Statistics
inlinenodiscard

Definition at line 392 of file thread_pool_with_errors.hpp.

◆ pending_tasks()

auto threadschedule::ThreadPoolWithErrors::pending_tasks ( ) const -> size_t
inlinenodiscard

Definition at line 428 of file thread_pool_with_errors.hpp.

◆ pool()

auto threadschedule::ThreadPoolWithErrors::pool ( ) -> ThreadPool&
inlinenodiscard

Definition at line 387 of file thread_pool_with_errors.hpp.

◆ reset_error_count()

void threadschedule::ThreadPoolWithErrors::reset_error_count ( )
inline

Definition at line 382 of file thread_pool_with_errors.hpp.

◆ set_affinity()

auto threadschedule::ThreadPoolWithErrors::set_affinity ( ThreadAffinity const & affinity) -> bool
inline

Definition at line 403 of file thread_pool_with_errors.hpp.

◆ shutdown()

void threadschedule::ThreadPoolWithErrors::shutdown ( )
inline

Definition at line 418 of file thread_pool_with_errors.hpp.

◆ size()

auto threadschedule::ThreadPoolWithErrors::size ( ) const -> size_t
inlinenodiscardnoexcept

Definition at line 423 of file thread_pool_with_errors.hpp.

◆ submit()

template<typename F, typename... Args>
auto threadschedule::ThreadPoolWithErrors::submit ( F && f,
Args &&... args ) -> FutureWithErrorHandler<std::invoke_result_t<F, Args...>>
inline

Definition at line 317 of file thread_pool_with_errors.hpp.

◆ submit_with_description()

template<typename F, typename... Args>
auto threadschedule::ThreadPoolWithErrors::submit_with_description ( std::string const & description,
F && f,
Args &&... args ) -> FutureWithErrorHandler<std::invoke_result_t<F, Args...>>
inline

Definition at line 341 of file thread_pool_with_errors.hpp.

◆ wait_for_tasks()

void threadschedule::ThreadPoolWithErrors::wait_for_tasks ( )
inline

Definition at line 413 of file thread_pool_with_errors.hpp.


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