A fast, lightweight, modern, and easy-to-use C++17/20/23 thread pool library for high-performance parallel computing.
BS::thread_pool is a C++ thread pool library that provides a fixed pool of reusable threads to execute tasks in parallel, avoiding the overhead of creating and destroying threads for each task. It solves the performance issues of low-level multithreading constructs like `std::thread` by efficiently managing task queues and thread reuse, making it suitable for high-performance computing applications.
C++ developers working on computationally intensive projects such as scientific computing, game development, or any application requiring efficient parallel task execution. It is particularly useful for those needing a lightweight, portable, and easy-to-integrate threading solution.
Developers choose BS::thread_pool for its combination of high performance, simplicity, and modern C++ features. It offers a rich set of functionalities like loop parallelization, task prioritization, and native OS extensions, all in a single header file with no dependencies, making it easy to integrate into existing projects.
BS::thread_pool: a fast, lightweight, modern, and easy-to-use C++17 / C++20 / C++23 thread pool library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The entire library is a single self-contained header file with no dependencies, making integration as simple as #include "BS_thread_pool.hpp"—ideal for drop-in use in existing projects.
Fully supports C++17, C++20, and C++23, including optional import as a C++20 module for faster compilation, as highlighted in the README's compatibility and module sections.
Offers loop parallelization, task prioritization, pausing/resuming, and native OS extensions for thread control, documented extensively with examples for common use cases.
Built from scratch for maximum performance with reusable threads and efficient task queuing, avoiding the overhead of repeatedly creating std::thread instances, as emphasized in the motivation section.
The library handles independent tasks well but lacks mechanisms for expressing dependencies between tasks, forcing users to manually manage ordering or use external synchronization.
Detached tasks via detach_task() don't return futures, making exception propagation difficult and requiring manual error handling, as noted in the documentation's warning sections.
Enabling optional features like native extensions or task prioritization requires defining macros or template parameters, adding configuration overhead compared to simpler libraries.