bs.thread_pool is a C++ Module port of BS::thread_pool, a fast, lightweight, modern, and easy-to-use thread pool library
Project is built using CMake/Ninja and packaged via CPS. CMake 4.4 and later is required.
Build using cmake, and consume via CPS by pointing to CMAKE_INSTALL_PREFIX via CMAKE_PREFIX_PATH
find_package(bs-thread_pool)
target_link_libraries($PROJECT PRIVATE bs-thread_pool::cxx_module)import std;
import bs.thread_pool;
auto main() -> int
{
bs::LightThreadPool pool;
std::future<int> answer = pool.submitTask([] { return 42; });
std::println("{}", answer.get());
}All options are CMake cache variables, off by default unless noted.
| Variable | Effect |
|---|---|
BS_THREAD_POOL_NATIVE_EXTENSIONS |
OS-native process/thread priority, affinity, and naming. On by default. |
BS_THREAD_POOL_BUILD_TESTS |
Build the test suite. |
BS_THREAD_POOL_BUILD_EXAMPLES |
Build the example programs. |
BS_THREAD_POOL_BUILD_BENCHMARKS |
Build the benchmark programs. Requires the native extensions. |
BS_THREAD_POOL_BUILD_DOCS |
Add a docs target that builds the Doxygen API reference. |
Types are PascalCase, functions are camelCase, and constants and enumerators
take a k prefix. Members that mirror a standard library interface — those of
bs::MultiFuture, for instance — keep the standard library's spelling instead.