Overview of BS::thread_pool features
masterBS::thread_pool is a high-performance, lightweight, header-only C++ thread pool library supporting C++17, C++20, and C++23.
Key Capabilities:
- Task Management: Submit tasks via
submit_task()(returnsstd::future) ordetach_task()(no future, higher performance). - Loop Parallelization: Use
submit_loop()to parallelize loops withBS::multi_futuretracking, ordetach_loop()for higher performance without futures. - Pool Control: Monitor tasks with
get_tasks_queued(),get_tasks_running(), andget_tasks_total(). Adjust thread count dynamically withreset(). Purge waiting tasks withpurge(). - Thread Lifecycle: Run initialization functions via the constructor and cleanup functions via
set_cleanup_func(). - Advanced Parallelism: Support for bulk task submission (
submit_bulk()), sequence parallelization (submit_sequence()), and block-based parallelization (submit_blocks()). - Optional Features: Supports task priority (-128 to +127), pausing/resuming the pool (
pause(),unpause()), and deadlock detection (BS::wait_deadlock). - Native Extensions: When
BS_THREAD_POOL_NATIVE_EXTENSIONSis defined, provides OS-specific controls for thread/process priority, affinity, and naming viaBS::this_threadandBS::get_os_process_*functions.