#ifndef WORKER_H #define WORKER_H #include #include #include #include #include #include #include #include class Work; class Worker { public: Worker(); ~Worker(); NO_COPY(Worker); NO_MOVE(Worker); using WorkPtr = std::unique_ptr; template void addWork(Params &&... params) { addWork(std::make_unique(std::forward(params)...)); } void addWork(WorkPtr w); private: void worker(); using Threads = std::vector; using ToDo = std::deque; Threads threads; ToDo todo; std::counting_semaphore<16> todoLen; std::mutex todoMutex; }; #endif