MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / drain_queue_impl

Method drain_queue_impl

source/executors/thread_pool_executor.cpp:317–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317bool thread_pool_worker::drain_queue_impl() {
318 auto aborted = false;
319
320 while (!m_private_queue.empty()) {
321 balance_work();
322
323 if (m_atomic_abort.load(std::memory_order_relaxed)) {
324 aborted = true;
325 break;
326 }
327
328 assert(!m_private_queue.empty());
329 auto task = std::move(m_private_queue.back());
330 m_private_queue.pop_back();
331 task();
332 }
333
334 if (aborted) {
335 std::unique_lock<std::mutex> lock(m_lock);
336 m_idle = true;
337 return false;
338 }
339
340 return true;
341}
342
343bool thread_pool_worker::drain_queue() {
344 std::unique_lock<std::mutex> lock(m_lock);

Callers

nothing calls this directly

Calls 2

taskFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected