hindi-sindhi-docker
/
mosesdecoder
/moses
/TranslationModel
/UG
/generic
/threading
/ug_thread_pool.h
| // -*- mode: c++; tab-width: 2; indent-tabs-mode: nil -*- | |
| namespace ug { | |
| class ThreadPool | |
| { | |
| typedef boost::asio::io_service service_t; | |
| service_t m_service; | |
| boost::thread_group m_pool; | |
| boost::scoped_ptr<service_t::work> m_busywork; | |
| std::vector<boost::shared_ptr<boost::thread> > m_workers; | |
| public: | |
| ThreadPool(size_t const num_workers); | |
| ~ThreadPool(); | |
| template<class callable> | |
| void add(callable& job) { m_service.post(job); } | |
| }; // end of class declaration ThreadPool | |
| } // end of namespace ug | |