A monitor is a high-level construct that bundles shared data with the procedures that access it, guaranteeing that only one thread is active inside at a time (Java synchronized methods are an example).
Condition variables (wait, signal, broadcast) let a thread sleep inside a monitor or mutex until a condition becomes true; always wait in a loop that rechecks the condition, because of spurious wakeups and because another thread may have changed the state first.
Loading…