Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 */

  /* . . . */
}

...