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

Method do_bulk_execute

3rd/asio-1.24.0/include/asio/impl/thread_pool.hpp:197–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195template <typename Allocator, unsigned int Bits>
196template <typename Function>
197void thread_pool::basic_executor_type<Allocator, Bits>::do_bulk_execute(
198 ASIO_MOVE_ARG(Function) f, std::size_t n, false_type) const
199{
200 typedef typename decay<Function>::type function_type;
201 typedef detail::bulk_executor_op<function_type, Allocator> op;
202
203 // Allocate and construct operations to wrap the function.
204 detail::op_queue<detail::scheduler_operation> ops;
205 for (std::size_t i = 0; i < n; ++i)
206 {
207 typename op::ptr p = { detail::addressof(allocator_),
208 op::ptr::allocate(allocator_), 0 };
209 p.p = new (p.v) op(ASIO_MOVE_CAST(Function)(f), allocator_, i);
210 ops.push(p.p);
211
212 if ((bits_ & relationship_continuation) != 0)
213 {
214 ASIO_HANDLER_CREATION((*pool_, *p.p,
215 "thread_pool", pool_, 0, "bulk_execute(blk=never,rel=cont)"));
216 }
217 else
218 {
219 ASIO_HANDLER_CREATION((*pool_, *p.p,
220 "thread_pool", pool_, 0, "bulk)execute(blk=never,rel=fork)"));
221 }
222
223 p.v = p.p = 0;
224 }
225
226 pool_->scheduler_.post_immediate_completions(n,
227 ops, (bits_ & relationship_continuation) != 0);
228}
229
230template <typename Function>
231struct thread_pool_always_blocking_function_adapter

Callers 1

bulk_executeFunction · 0.80

Calls 3

do_executeMethod · 0.95
pushMethod · 0.80
allocateFunction · 0.50

Tested by

no test coverage detected