#pragma once #include #include #include #include #include struct ThreadWorkerData { std::function func; std::mutex m; std::condition_variable cond; bool started; bool finished; bool running; }; void _global_thread_worker_main(ThreadWorkerData* ptdd); class ThreadPool { public: ThreadPool(int n); ~ThreadPool(); int start(const std::function& func); private: std::vector dvec; std::vector tvec; int left; int busy; int total; };