1 // Copyright (C) 2014 Ian Forbed
2 // Copyright (C) 2014 Vicente J. Botet Escriba
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP
9 #define BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP
11 #include <boost/thread/detail/config.hpp>
12 #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION && defined BOOST_THREAD_PROVIDES_EXECUTORS && defined BOOST_THREAD_USES_MOVE
14 #include <boost/thread/executors/detail/scheduled_executor_base.hpp>
21 class scheduled_thread_pool : public detail::scheduled_executor_base<>
24 thread_group _workers;
27 scheduled_thread_pool(size_t num_threads) : super()
29 for(size_t i = 0; i < num_threads; i++)
31 _workers.create_thread(bind(&super::loop, this));
35 ~scheduled_thread_pool()
38 _workers.interrupt_all();
43 typedef detail::scheduled_executor_base<> super;
46 } //end executors namespace
48 using executors::scheduled_thread_pool;