]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/thread/executors/scheduled_thread_pool.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / thread / executors / scheduled_thread_pool.hpp
1 // Copyright (C) 2014 Ian Forbed
2 // Copyright (C) 2014 Vicente J. Botet Escriba
3 //
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)
6 //
7
8 #ifndef BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP
9 #define BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP
10
11 #include <boost/thread/executors/detail/scheduled_executor_base.hpp>
12
13 namespace boost
14 {
15 namespace executors
16 {
17
18 class scheduled_thread_pool : public detail::scheduled_executor_base<>
19 {
20 private:
21 thread_group _workers;
22 public:
23
24 scheduled_thread_pool(size_t num_threads) : super()
25 {
26 for(size_t i = 0; i < num_threads; i++)
27 {
28 _workers.create_thread(bind(&super::loop, this));
29 }
30 }
31
32 ~scheduled_thread_pool()
33 {
34 this->close();
35 _workers.interrupt_all();
36 _workers.join_all();
37 }
38
39 private:
40 typedef detail::scheduled_executor_base<> super;
41 }; //end class
42
43 } //end executors namespace
44
45 using executors::scheduled_thread_pool;
46
47 } //end boost
48 #endif
49