12 threadCount = std::thread::hardware_concurrency();
14 for (
size_t i = 0; i < threadCount; ++i) {
25 for (std::thread &worker :
workers) {
26 if (worker.joinable()) {
42 std::unique_lock<std::mutex> lock(
waitMutex);
48 std::function<void()> task;
62 std::unique_lock<std::mutex> lock(
waitMutex);
std::condition_variable queueCondition
void dispatch(std::function< void()> task)
Dispatch a task to the thread pool.
std::atomic< size_t > activeTasks
std::queue< std::function< void()> > taskQueue
void wait()
Wait for all dispatched tasks to complete.
std::vector< std::thread > workers
CodegenTaskDispatcher(size_t threadCount=0)
std::condition_variable waitCondition