Multiple ChoiceIntermediate 45s
Why condition_variable wait needs a predicate loop
Why must condition_variable::wait be used with a predicate (or in a loop) rather than a bare wait?
Options
- 1Because the mutex otherwise remains locked forever
- 2Because the predicate increases the priority of the waiting thread
- 3Because wait can return spuriously and the predicate re-checks the condition
- 4Because std::condition_variable requires a predicate to compile
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.