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