MCPcopy Create free account
hub / github.com/defold/defold / wait_for_all

Method wait_for_all

engine/dlib/src/basis/encoder/basisu_enc.cpp:1567–1586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1565 }
1566
1567 void job_pool::wait_for_all()
1568 {
1569 std::unique_lock<std::mutex> lock(m_mutex);
1570
1571 // Drain the job queue on the calling thread.
1572 while (!m_queue.empty())
1573 {
1574 std::function<void()> job(m_queue.back());
1575 m_queue.pop_back();
1576
1577 lock.unlock();
1578
1579 job();
1580
1581 lock.lock();
1582 }
1583
1584 // The queue is empty, now wait for all active jobs to finish up.
1585 m_no_more_jobs.wait(lock, [this]{ return !m_num_active_jobs; } );
1586 }
1587
1588 void job_pool::job_thread(uint32_t index)
1589 {

Calls 4

emptyMethod · 0.45
pop_backMethod · 0.45
unlockMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected