Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/thread/executors/scheduled_thread_pool.hpp @ 133:4acb5d8d80b6 tip
Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author | Chris Cannam |
---|---|
date | Tue, 30 Jul 2019 12:25:44 +0100 |
parents | f46d142149f5 |
children |
rev | line source |
---|---|
Chris@102 | 1 // Copyright (C) 2014 Ian Forbed |
Chris@102 | 2 // Copyright (C) 2014 Vicente J. Botet Escriba |
Chris@102 | 3 // |
Chris@102 | 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying |
Chris@102 | 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@102 | 6 // |
Chris@102 | 7 |
Chris@102 | 8 #ifndef BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP |
Chris@102 | 9 #define BOOST_THREAD_EXECUTORS_SCHEDULED_THREAD_POOL_HPP |
Chris@102 | 10 |
Chris@102 | 11 #include <boost/thread/executors/detail/scheduled_executor_base.hpp> |
Chris@102 | 12 |
Chris@102 | 13 namespace boost |
Chris@102 | 14 { |
Chris@102 | 15 namespace executors |
Chris@102 | 16 { |
Chris@102 | 17 |
Chris@102 | 18 class scheduled_thread_pool : public detail::scheduled_executor_base<> |
Chris@102 | 19 { |
Chris@102 | 20 private: |
Chris@102 | 21 thread_group _workers; |
Chris@102 | 22 public: |
Chris@102 | 23 |
Chris@102 | 24 scheduled_thread_pool(size_t num_threads) : super() |
Chris@102 | 25 { |
Chris@102 | 26 for(size_t i = 0; i < num_threads; i++) |
Chris@102 | 27 { |
Chris@102 | 28 _workers.create_thread(bind(&super::loop, this)); |
Chris@102 | 29 } |
Chris@102 | 30 } |
Chris@102 | 31 |
Chris@102 | 32 ~scheduled_thread_pool() |
Chris@102 | 33 { |
Chris@102 | 34 this->close(); |
Chris@102 | 35 _workers.join_all(); |
Chris@102 | 36 } |
Chris@102 | 37 |
Chris@102 | 38 private: |
Chris@102 | 39 typedef detail::scheduled_executor_base<> super; |
Chris@102 | 40 }; //end class |
Chris@102 | 41 |
Chris@102 | 42 } //end executors namespace |
Chris@102 | 43 |
Chris@102 | 44 using executors::scheduled_thread_pool; |
Chris@102 | 45 |
Chris@102 | 46 } //end boost |
Chris@102 | 47 #endif |
Chris@102 | 48 |