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

Method wait_for_task

source/executors/worker_thread_executor.cpp:42–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void worker_thread_executor::wait_for_task(std::unique_lock<std::mutex>& lock) {
43 assert(lock.owns_lock());
44 if (!m_public_queue.empty() || m_abort) {
45 return;
46 }
47
48 while (true) {
49 lock.unlock();
50
51 m_semaphore.acquire();
52
53 lock.lock();
54 if (!m_public_queue.empty() || m_abort) {
55 break;
56 }
57 }
58}
59
60bool worker_thread_executor::drain_queue() {
61 std::unique_lock<std::mutex> lock(m_lock);

Callers

nothing calls this directly

Calls 4

owns_lockMethod · 0.80
unlockMethod · 0.80
lockMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected