Basically, notification of a condition variable really only declares "the condition you are looking for may have occurred."
The only thing that can have bidirectional communication with one condition variable is that the stream can be triggered by a notification when there is no data available for it. The correct use of condition variables is performed in the while loop, so the worst case is that the thread does not see that the data is available, and returns to sleep again. It is absolutely safe, therefore bi-directional communication with one condition variable is possible.
At the same time, there are few advantages for waking up threads unnecessarily, therefore it is usually preferable to have one mutex that protects data (i.e. you must store mutexes to access data) and two different variable conditions indicating different conditions. This will minimize how much once you wake up a thread to find it on which there is no data to work with (called a "false" notification).
source share