A CV is an inter-thread event notification mechanism. Where we use the mutex lock to synchronize (serialize) access to a critical section, thus protecting it, we use condition variables to facilitate efficient communication—in terms of synchronizing based on the value of a data item—between the threads of a process. The following discussion will make this clearer.
Often, in multithreaded application design and implementation, one is faced with this type of situation: a thread, B, is performing some work and another thread, A, is awaiting the completion of that work. Only when thread B completes the work should thread A continue; how can we efficiently implement this in code?