#pragma once #include "Queue.h" #include "Types.h" namespace VWeb { struct WorkerJob { virtual ~WorkerJob() = default; virtual void Execute() = 0; }; class ThreadPool { public: explicit ThreadPool(std::string name); void SetThreadCount(int); void Dispatch(const Ref &); void Create(); void Stop(); void Execute(); protected: std::string m_Name; int m_ThreadCount{1}; bool m_IsCreated{false}; std::vector m_Threads{}; SafeQueue> m_Queue; bool m_IsDone{false}; }; } // namespace VWeb