15 #include <BS_thread_pool.hpp>
48 auto counter = std::make_shared<std::atomic<unsigned int>>(0);
49 return [counter = std::move(counter), prefix = std::move(prefix)]() {
50 unsigned int const idx = counter->fetch_add(1, std::memory_order_relaxed);
52 std::array<char, 16> name{};
53 std::snprintf(name.data(), name.size(),
"%s-%u", prefix.c_str(), idx);
54 pthread_setname_np(pthread_self(), name.data());
BS::thread_pool ThreadPool
Thread pool type used for parallel I/O operations.
std::function< void()> make_thread_pool_init_task(std::string prefix)
Build a BS::thread_pool init task that names each worker thread.