//  // // ##### #### # # -= Threadux =-  // //  # # # ## ## ThreadPool.h  // //  # # # ##  // //  # # # ### Scalable workload distribution server  // //  # # # ## ##  // //  # #### # # R1 2004 by Markus Ewald  // //  // #ifndef THREADUX_THREADPOOL_H #define THREADUX_THREADPOOL_H #include "Threadux/Threadux.h" #include "Threadux/Invocation.h" #include namespace Threadux { //  // //  Threadux::ThreadPool  // //  // /// Thread pool class ThreadPool { public: /// Get optimum thread count for the system static size_t getOptimumThreadCount(); /// Constructor explicit ThreadPool(size_t ThreadCount = ThreadPool::getOptimumThreadCount()); /// Destructor ~ThreadPool(); // // ThreadPool implementation // public: /// Get number of threads size_t getThreadCount() const; /// Rescale the thread pool to the specified number of threads void rescale(size_t ThreadCount = ThreadPool::getOptimumThreadCount()); /// Enqueue an invocation to be executed by the thread pool void enqueue(const Invocation &TheInvocation); private: ThreadPool(const ThreadPool &); void operator =(const ThreadPool &); typedef std::deque InvocationDeque; /// Number of threads we are targeting for size_t m_DesiredThreadCount; /// Queued tasks to be executed by the worker threads InvocationDeque m_QueuedTasks; }; } // namespace Threadux #endif // THREADUX_THREADPOOL_H