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

FastThreadPool combined with an ErrorHandler. More...

#include <thread_pool_with_errors.hpp>

Public Member Functions

 FastThreadPoolWithErrors (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 () -> FastThreadPool &
auto get_statistics () const -> FastThreadPool::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

FastThreadPool combined with an ErrorHandler.

Non-copyable, non-movable. Thread-safe (delegates to the underlying FastThreadPool). 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 191 of file thread_pool_with_errors.hpp.

Constructor & Destructor Documentation

◆ FastThreadPoolWithErrors()

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

Definition at line 194 of file thread_pool_with_errors.hpp.

Member Function Documentation

◆ add_error_callback()

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

Definition at line 250 of file thread_pool_with_errors.hpp.

◆ clear_error_callbacks()

void threadschedule::FastThreadPoolWithErrors::clear_error_callbacks ( )
inline

Definition at line 255 of file thread_pool_with_errors.hpp.

◆ configure_threads()

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

Definition at line 280 of file thread_pool_with_errors.hpp.

◆ distribute_across_cpus()

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

Definition at line 291 of file thread_pool_with_errors.hpp.

◆ error_count()

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

Definition at line 260 of file thread_pool_with_errors.hpp.

◆ get_statistics()

auto threadschedule::FastThreadPoolWithErrors::get_statistics ( ) const -> FastThreadPool::Statistics
inlinenodiscard

Definition at line 275 of file thread_pool_with_errors.hpp.

◆ pending_tasks()

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

Definition at line 311 of file thread_pool_with_errors.hpp.

◆ pool()

auto threadschedule::FastThreadPoolWithErrors::pool ( ) -> FastThreadPool&
inlinenodiscard

Definition at line 270 of file thread_pool_with_errors.hpp.

◆ reset_error_count()

void threadschedule::FastThreadPoolWithErrors::reset_error_count ( )
inline

Definition at line 265 of file thread_pool_with_errors.hpp.

◆ set_affinity()

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

Definition at line 286 of file thread_pool_with_errors.hpp.

◆ shutdown()

void threadschedule::FastThreadPoolWithErrors::shutdown ( )
inline

Definition at line 301 of file thread_pool_with_errors.hpp.

◆ size()

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

Definition at line 306 of file thread_pool_with_errors.hpp.

◆ submit()

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

Definition at line 200 of file thread_pool_with_errors.hpp.

◆ submit_with_description()

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

Definition at line 224 of file thread_pool_with_errors.hpp.

◆ wait_for_tasks()

void threadschedule::FastThreadPoolWithErrors::wait_for_tasks ( )
inline

Definition at line 296 of file thread_pool_with_errors.hpp.


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