]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/thread/executors/scheduling_adaptor.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / thread / executors / scheduling_adaptor.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_SCHEDULING_ADAPTOR_HPP
9 #define BOOST_THREAD_EXECUTORS_SCHEDULING_ADAPTOR_HPP
10
11 #include <boost/thread/executors/detail/scheduled_executor_base.hpp>
12
13 #if defined(BOOST_MSVC)
14 # pragma warning(push)
15 # pragma warning(disable: 4355) // 'this' : used in base member initializer list
16 #endif
17
18 namespace boost
19 {
20 namespace executors
21 {
22
23 template <typename Executor>
24 class scheduling_adaptor : public detail::scheduled_executor_base<>
25 {
26 private:
27 Executor& _exec;
28 thread _scheduler;
29 public:
30
31 scheduling_adaptor(Executor& ex)
32 : super(),
33 _exec(ex),
34 _scheduler(&super::loop, this) {}
35
36 ~scheduling_adaptor()
37 {
38 this->close();
39 _scheduler.interrupt();
40 _scheduler.join();
41 }
42
43 Executor& underlying_executor()
44 {
45 return _exec;
46 }
47
48 private:
49 typedef detail::scheduled_executor_base<> super;
50 }; //end class
51
52 } //end executors
53
54 using executors::scheduling_adaptor;
55
56 } //end boost
57
58 #if defined(BOOST_MSVC)
59 # pragma warning(pop)
60 #endif
61
62 #endif