Condition Variables
A place to wait. Sometimes called a “rendezvous point”
The actual logic is provided by the program, not by the condition variable
BOOLEAN NoteEnoughMilk, MilkInTransit;
CONDITION MilkCondition
IF (NotEnoughMilk AND MilkInTransit) THEN
Condition.Wait(MilkCondition);
Three operations on condition variables
- Condition.Wait(c)
- release monitor lock, wait for someone to signal condition
- Condition.Signal(c)
- Condition.Broadcast(c)
- wakeup all waiting threads