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

Method defer

include/boost/asio/impl/thread_pool.hpp:299–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297template <typename Allocator, unsigned int Bits>
298template <typename Function, typename OtherAllocator>
299void thread_pool::basic_executor_type<Allocator, Bits>::defer(
300 Function&& f, const OtherAllocator& a) const
301{
302 typedef decay_t<Function> function_type;
303
304 // Allocate and construct an operation to wrap the function.
305 typedef detail::executor_op<function_type, OtherAllocator> op;
306 typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
307 p.p = new (p.v) op(static_cast<Function&&>(f), a);
308
309 BOOST_ASIO_HANDLER_CREATION((*pool_, *p.p,
310 "thread_pool", pool_, 0, "defer"));
311
312 pool_->scheduler_.post_immediate_completion(p.p, true);
313 p.v = p.p = 0;
314}
315#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
316
317BOOST_ASIO_INLINE_NAMESPACE_END

Callers

nothing calls this directly

Calls 2

allocateFunction · 0.50

Tested by

no test coverage detected