File indexing completed on 2025-01-30 10:01:11
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_THREAD_EXECUTORS_SCHEDULING_ADAPTOR_HPP
0009 #define BOOST_THREAD_EXECUTORS_SCHEDULING_ADAPTOR_HPP
0010
0011 #include <boost/thread/detail/config.hpp>
0012 #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION && defined BOOST_THREAD_PROVIDES_EXECUTORS && defined BOOST_THREAD_USES_MOVE
0013 #include <boost/thread/executors/detail/scheduled_executor_base.hpp>
0014
0015 #if defined(BOOST_MSVC)
0016 # pragma warning(push)
0017 # pragma warning(disable: 4355)
0018 #endif
0019
0020 namespace boost
0021 {
0022 namespace executors
0023 {
0024
0025 template <typename Executor>
0026 class scheduling_adaptor : public detail::scheduled_executor_base<>
0027 {
0028 private:
0029 Executor& _exec;
0030 thread _scheduler;
0031 public:
0032
0033 scheduling_adaptor(Executor& ex)
0034 : super(),
0035 _exec(ex),
0036 _scheduler(&super::loop, this) {}
0037
0038 ~scheduling_adaptor()
0039 {
0040 this->close();
0041 _scheduler.interrupt();
0042 _scheduler.join();
0043 }
0044
0045 Executor& underlying_executor()
0046 {
0047 return _exec;
0048 }
0049
0050 private:
0051 typedef detail::scheduled_executor_base<> super;
0052 };
0053
0054 }
0055
0056 using executors::scheduling_adaptor;
0057
0058 }
0059
0060 #if defined(BOOST_MSVC)
0061 # pragma warning(pop)
0062 #endif
0063
0064 #endif
0065 #endif