Multiple ChoiceBeginner 45s
Atomic wait/notify Semantics
Which statement about C++20 std::atomic::wait/notify_one is correct?
Options
- 1wait always returns spuriously and must be re-checked in a loop over the atomic value
- 2notify_one wakes all waiting threads, while notify_all wakes exactly one of them
- 3wait atomically loads and returns immediately whenever the stored value differs, without blocking
- 4wait requires an external mutex to be held by the caller for the whole blocking duration
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.