11 #ifndef ASIO_DETAIL_WORK_DISPATCHER_HPP 12 #define ASIO_DETAIL_WORK_DISPATCHER_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 19 #include "asio/detail/type_traits.hpp" 20 #include "asio/associated_executor.hpp" 21 #include "asio/associated_allocator.hpp" 22 #include "asio/executor_work_guard.hpp" 23 #include "asio/execution/executor.hpp" 24 #include "asio/execution/allocator.hpp" 25 #include "asio/execution/blocking.hpp" 26 #include "asio/execution/outstanding_work.hpp" 27 #include "asio/prefer.hpp" 29 #include "asio/detail/push_options.hpp" 34 template <
typename Handler,
typename Executor,
typename =
void>
39 template <
typename Handler,
typename Executor>
44 Executor>::asio_associated_executor_is_unspecialised,
51 template <
typename Handler,
typename Executor,
typename =
void>
55 template <
typename CompletionHandler>
57 const Executor& handler_ex)
58 : handler_(ASIO_MOVE_CAST(CompletionHandler)(handler)),
59 executor_(asio::prefer(handler_ex,
60 execution::outstanding_work.tracked))
64 #if defined(ASIO_HAS_MOVE) 66 : handler_(other.handler_),
67 executor_(other.executor_)
72 : handler_(ASIO_MOVE_CAST(Handler)(other.handler_)),
73 executor_(ASIO_MOVE_CAST(work_executor_type)(other.executor_))
76 #endif // defined(ASIO_HAS_MOVE) 81 asio::prefer(executor_,
82 execution::blocking.possibly,
83 execution::allocator((get_associated_allocator)(handler_))),
84 ASIO_MOVE_CAST(Handler)(handler_));
88 typedef typename decay<
92 >::type work_executor_type;
95 work_executor_type executor_;
98 #if !defined(ASIO_NO_TS_EXECUTORS) 100 template <
typename Handler,
typename Executor>
105 template <
typename CompletionHandler>
107 const Executor& handler_ex)
109 handler_(ASIO_MOVE_CAST(CompletionHandler)(handler))
113 #if defined(ASIO_HAS_MOVE) 115 : work_(other.work_),
116 handler_(other.handler_)
122 handler_(ASIO_MOVE_CAST(Handler)(other.handler_))
125 #endif // defined(ASIO_HAS_MOVE) 130 (get_associated_allocator)(handler_));
131 work_.get_executor().dispatch(
132 ASIO_MOVE_CAST(Handler)(handler_), alloc);
141 #endif // !defined(ASIO_NO_TS_EXECUTORS) 146 #include "asio/detail/pop_options.hpp" 148 #endif // ASIO_DETAIL_WORK_DISPATCHER_HPP Definition: work_dispatcher.hpp:35
Definition: work_dispatcher.hpp:52
Definition: is_executor.hpp:114
Definition: type_traits.hpp:97
Definition: outstanding_work.hpp:153
Traits type used to obtain the executor associated with an object.
Definition: associated_executor.hpp:76
Definition: prefer.hpp:623
Definition: handler_work.hpp:37
detail::associated_allocator_impl< T, Allocator >::type type
If T has a nested type allocator_type, T::allocator_type.
Definition: associated_allocator.hpp:79
Definition: any_io_executor.hpp:28