MCPcopy Create free account
hub / github.com/boostorg/asio / defer

Method defer

include/boost/asio/impl/system_executor.hpp:159–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157template <typename Blocking, typename Relationship, typename Allocator>
158template <typename Function, typename OtherAllocator>
159void basic_system_executor<Blocking, Relationship, Allocator>::defer(
160 Function&& f, const OtherAllocator& a) const
161{
162 system_context& ctx = detail::global<system_context>();
163
164 // Allocate and construct an operation to wrap the function.
165 typedef detail::executor_op<decay_t<Function>, OtherAllocator> op;
166 typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
167 p.p = new (p.v) op(static_cast<Function&&>(f), a);
168
169 BOOST_ASIO_HANDLER_CREATION((ctx, *p.p,
170 "system_executor", &this->context(), 0, "defer"));
171
172 ctx.scheduler_.post_immediate_completion(p.p, true);
173 p.v = p.p = 0;
174}
175#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
176
177BOOST_ASIO_INLINE_NAMESPACE_END

Callers

nothing calls this directly

Calls 3

allocateFunction · 0.50
contextMethod · 0.45

Tested by

no test coverage detected