#ifndef __THREAD_POOL_HPP__ #define __THREAD_POOL_HPP__ #include #include #include #include class thread_pool : boost::noncopyable { public: typedef boost::function function_type; private: boost::thread_group threads; std::queue work; boost::mutex work_mutex; boost::condition work_condition; bool running; void worker(); public: thread_pool(unsigned short threadcount); ~thread_pool(); void queue(const function_type &fn); }; #endif