std::condition_variable
`std::condition_variable` is a synchronization primitive in C++ that allows threads to wait for certain conditions to be met before continuing execution. It is typically used in conjunction with a mutex to protect shared data. When a thread needs to wait, it can call `wait()` on the condition variable, which releases the associated mutex and puts the thread to sleep until another thread signals that the condition has changed.
To signal waiting threads, another thread can call `notify_one()` or `notify_all()` on the condition variable. `notify_one()` wakes up a single waiting thread, while `notify_all()` wakes up all waiting threads. This mechanism helps manage thread coordination and ensures that resources are used efficiently without busy-waiting.