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

Method drain_queue

source/executors/worker_thread_executor.cpp:60–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60bool worker_thread_executor::drain_queue() {
61 std::unique_lock<std::mutex> lock(m_lock);
62 wait_for_task(lock);
63
64 assert(lock.owns_lock());
65 assert(!m_public_queue.empty() || m_abort);
66
67 if (m_abort) {
68 return false;
69 }
70
71 assert(m_private_queue.empty());
72 std::swap(m_private_queue, m_public_queue); // reuse underlying allocations.
73 lock.unlock();
74
75 return drain_queue_impl();
76}
77
78void worker_thread_executor::work_loop() {
79 details::s_tl_this_worker = this;

Callers

nothing calls this directly

Calls 3

owns_lockMethod · 0.80
unlockMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected