Difference between std::atomic and std::condition_variable wait, notify_* methods
问题 I was looking through 'Atomic operations library' and came across a new c++20 feature of atomic 'wait' and 'notify_ ' methods. I am curious on what the differences are in regards to std::condition_variable's 'wait' and 'notify_ ' methods. 回答1: std:atomic wait , notify_all and notify_one methods are similar to methods of conditional variables. They allow the implementation of the logic that previously required conditional variable by using much more efficient and lightweight atomic variables.