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