All challenges
Code AnalysisBeginner 60s

condition_variable wait predicate

Why is the loop (or predicate overload) required here?
Starter code
std::unique_lock<std::mutex> lk(m);
while (!ready)
    cv.wait(lk); // vs cv.wait(lk, []{return ready;});

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle