MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / initiate_spawn

Class initiate_spawn

3rd/asio-1.24.0/include/asio/impl/spawn.hpp:1120–1207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118
1119template <typename Executor>
1120class initiate_spawn
1121{
1122public:
1123 typedef Executor executor_type;
1124
1125 explicit initiate_spawn(const executor_type& ex)
1126 : executor_(ex)
1127 {
1128 }
1129
1130 executor_type get_executor() const ASIO_NOEXCEPT
1131 {
1132 return executor_;
1133 }
1134
1135 template <typename Handler, typename F>
1136 void operator()(ASIO_MOVE_ARG(Handler) handler,
1137 ASIO_MOVE_ARG(F) f) const
1138 {
1139 typedef typename decay<Handler>::type handler_type;
1140 typedef typename decay<F>::type function_type;
1141 typedef spawn_cancellation_handler<
1142 handler_type, Executor> cancel_handler_type;
1143
1144 typename associated_cancellation_slot<handler_type>::type slot
1145 = asio::get_associated_cancellation_slot(handler);
1146
1147 cancel_handler_type* cancel_handler = slot.is_connected()
1148 ? &slot.template emplace<cancel_handler_type>(handler, executor_)
1149 : 0;
1150
1151 cancellation_slot proxy_slot(
1152 cancel_handler
1153 ? cancel_handler->slot()
1154 : cancellation_slot());
1155
1156 cancellation_state cancel_state(proxy_slot);
1157
1158 (dispatch)(executor_,
1159 spawned_thread_resumer(
1160 default_spawned_thread_type::spawn(
1161 spawn_entry_point<Executor, function_type, handler_type>(
1162 executor_, ASIO_MOVE_CAST(F)(f),
1163 ASIO_MOVE_CAST(Handler)(handler)),
1164 proxy_slot, cancel_state)));
1165 }
1166
1167#if defined(ASIO_HAS_BOOST_CONTEXT_FIBER)
1168
1169 template <typename Handler, typename StackAllocator, typename F>
1170 void operator()(ASIO_MOVE_ARG(Handler) handler, allocator_arg_t,
1171 ASIO_MOVE_ARG(StackAllocator) stack_allocator,
1172 ASIO_MOVE_ARG(F) f) const
1173 {
1174 typedef typename decay<Handler>::type handler_type;
1175 typedef typename decay<F>::type function_type;
1176 typedef spawn_cancellation_handler<
1177 handler_type, Executor> cancel_handler_type;

Callers

nothing calls this directly

Calls 5

cancellation_slotClass · 0.85
spawnFunction · 0.85
allocator_arg_tClass · 0.85
slotMethod · 0.45

Tested by

no test coverage detected