What's the difference between notify_all() and notify_one() of std::condition_variable?
If there are ten threads blocked on the condition variable, for example, notify_one()
will unblock only one thread, while notify_all()
will unblock them all. In your case, you'll want to use notify_one()
so you don't wake up threads that don't have any work waiting for them.