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

ThreadPool combined with an ErrorHandler. 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

ThreadPool combined with an ErrorHandler.

Non-copyable, non-movable. Thread-safe (delegates to the underlying ThreadPool). Same error-handling semantics as HighPerformancePoolWithErrors: exceptions are reported to the ErrorHandler and re-thrown through the future.

See also
HighPerformancePoolWithErrors for detailed behaviour.

Definition at line 331 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 334 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 390 of file thread_pool_with_errors.hpp.

◆ clear_error_callbacks()

void threadschedule::ThreadPoolWithErrors::clear_error_callbacks ( )
inline

Definition at line 395 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 420 of file thread_pool_with_errors.hpp.

◆ distribute_across_cpus()

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

Definition at line 431 of file thread_pool_with_errors.hpp.

◆ error_count()

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

Definition at line 400 of file thread_pool_with_errors.hpp.

◆ get_statistics()

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

Definition at line 415 of file thread_pool_with_errors.hpp.

◆ pending_tasks()

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

Definition at line 451 of file thread_pool_with_errors.hpp.

◆ pool()

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

Definition at line 410 of file thread_pool_with_errors.hpp.

◆ reset_error_count()

void threadschedule::ThreadPoolWithErrors::reset_error_count ( )
inline

Definition at line 405 of file thread_pool_with_errors.hpp.

◆ set_affinity()

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

Definition at line 426 of file thread_pool_with_errors.hpp.

◆ shutdown()

void threadschedule::ThreadPoolWithErrors::shutdown ( )
inline

Definition at line 441 of file thread_pool_with_errors.hpp.

◆ size()

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

Definition at line 446 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 340 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 364 of file thread_pool_with_errors.hpp.

◆ wait_for_tasks()

void threadschedule::ThreadPoolWithErrors::wait_for_tasks ( )
inline

Definition at line 436 of file thread_pool_with_errors.hpp.


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