Condition variable and shared mutex Condition variable and shared mutex multithreading multithreading

Condition variable and shared mutex


This is defined by the standard to allow for maximum efficiency of the implementation. If you want to use a different lock with condition_variable you need to use condition_variable_any. Note that the condition_variable_any implementation has some overhead though.

Quote from the standard: 30.5 Condition variables

Class condition_variable provides a condition variable that can only wait on an object of type unique_lock<mutex>, allowing maximum effciency on some platforms.