...
Code Block |
---|
#include <condition_variable> #include <mutex> extern bool until_finish(void); extern std::mutex m; extern std::condition_variable condition; void func(void) { std::unique_lock<std::mutex> lk(m); while (until_finish()) { /* Predicate does not hold */ condition.wait(lk); } /* Resume when condition holds */ /* . . . */ } |
...