Condition Variable Spurious Wakeup
Why must condition variable waits always be used with a while loop checking a predicate rather than an if statement?
// Bad
if (!predicate) cv.wait(lock);
// Good
while (!predicate) cv.wait(lock);
Sign in to answer questions and track your progress
Sign In