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

Method defer

include/boost/asio/impl/io_context.hpp:319–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317template <typename Allocator, uintptr_t Bits>
318template <typename Function, typename OtherAllocator>
319void io_context::basic_executor_type<Allocator, Bits>::defer(
320 Function&& f, const OtherAllocator& a) const
321{
322 // Allocate and construct an operation to wrap the function.
323 typedef detail::executor_op<decay_t<Function>,
324 OtherAllocator, detail::operation> op;
325 typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
326 p.p = new (p.v) op(static_cast<Function&&>(f), a);
327
328 BOOST_ASIO_HANDLER_CREATION((*context_ptr(), *p.p,
329 "io_context", context_ptr(), 0, "defer"));
330
331 context_ptr()->impl_.post_immediate_completion(p.p, true);
332 p.v = p.p = 0;
333}
334#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
335
336inline boost::asio::io_context& io_context::service::get_io_context()

Callers

nothing calls this directly

Calls 2

allocateFunction · 0.50

Tested by

no test coverage detected