MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / wait

Method wait

src/runtime/generic/async_worker.cpp:34–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void worker_thread::wait()
35{
36 std::unique_lock<std::mutex> lock(_mutex);
37 if(!_enqueued_operations.empty())
38 {
39 // Before going to sleep, wake up the other thread to avoid deadlocks
40 _condition_wait.notify_all();
41 // Wait until no operation is pending
42 _condition_wait.wait(lock, [this]{return _enqueued_operations.empty();});
43 }
44 assert(_enqueued_operations.empty());
45}
46
47
48void worker_thread::halt()

Callers 1

workMethod · 0.45

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected