ThreadSchedule 1.0.0
Modern C++ thread management library
|
Simple high-performance thread pool using single queue with optimized locking. More...
#include <thread_pool.hpp>
Classes | |
struct | Statistics |
Public Types | |
using | Task = std::function<void()> |
Public Member Functions | |
FastThreadPool (size_t num_threads=std::thread::hardware_concurrency()) | |
FastThreadPool (FastThreadPool const &)=delete | |
auto | operator= (FastThreadPool const &) -> FastThreadPool &=delete |
template<typename F, typename... Args> | |
auto | submit (F &&f, Args &&... args) -> std::future< std::invoke_result_t< F, Args... > > |
Optimized task submission with minimal locking. | |
template<typename Iterator> | |
auto | submit_batch (Iterator begin, Iterator end) -> std::vector< std::future< void > > |
Efficient batch processing. | |
void | shutdown () |
auto | configure_threads (std::string const &name_prefix, SchedulingPolicy policy=SchedulingPolicy::OTHER, ThreadPriority priority=ThreadPriority::normal()) -> bool |
auto | distribute_across_cpus () -> bool |
auto | size () const noexcept -> size_t |
auto | pending_tasks () const -> size_t |
auto | get_statistics () const -> Statistics |
Simple high-performance thread pool using single queue with optimized locking.
Alternative implementation for cases where work-stealing overhead is not justified. Uses a single queue with optimized batch processing and minimal locking.
Best for: Medium workloads (100-10k tasks), consistent task patterns where work-stealing complexity isn't needed but better performance than basic ThreadPool is desired.
Definition at line 603 of file thread_pool.hpp.
using threadschedule::FastThreadPool::Task = std::function<void()> |
Definition at line 606 of file thread_pool.hpp.
|
inlineexplicit |
Definition at line 618 of file thread_pool.hpp.
|
inline |
Definition at line 633 of file thread_pool.hpp.
|
inline |
Definition at line 716 of file thread_pool.hpp.
|
inline |
Definition at line 739 of file thread_pool.hpp.
|
inline |
Definition at line 770 of file thread_pool.hpp.
|
inline |
Definition at line 764 of file thread_pool.hpp.
|
inline |
Definition at line 694 of file thread_pool.hpp.
|
inlinenoexcept |
Definition at line 759 of file thread_pool.hpp.
|
inline |
Optimized task submission with minimal locking.
Definition at line 642 of file thread_pool.hpp.
|
inline |
Efficient batch processing.
Definition at line 668 of file thread_pool.hpp.