MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / do_job

Method do_job

Src/Base/AMReX_BackgroundThread.cpp:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void BackgroundThread::do_job ()
20{
21 while (true)
22 {
23 std::unique_lock<std::mutex> lck(m_mutx);
24 m_job_cond.wait(lck, [this] () -> bool { return !m_func.empty(); });
25 auto f = m_func.front();
26 m_func.pop();
27 lck.unlock();
28 f();
29 if (m_clearing) { // All jobs before this have finished.
30 m_done_cond.notify_one();
31 }
32 if (m_finalizing) {
33 break;
34 }
35 }
36}
37
38void BackgroundThread::Submit (std::function<void()>&& a_f)
39{

Callers

nothing calls this directly

Calls 5

unlockMethod · 0.80
fFunction · 0.50
waitMethod · 0.45
emptyMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected