// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include #include #include #include #include #include #include #include namespace zen { struct IWork : public RefCounted { virtual void Execute() = 0; inline std::exception_ptr GetException() { return m_Exception; } private: std::exception_ptr m_Exception; friend class WorkerThreadPool; }; class WorkerThreadPool { public: WorkerThreadPool(int InThreadCount); ~WorkerThreadPool(); void ScheduleWork(Ref Work); void ScheduleWork(std::function&& Work); void WorkerThreadFunction(); private: std::vector m_WorkerThreads; BlockingQueue> m_WorkQueue; }; } // namespace zen