Condition Variables

cond_wait(lock, cond_var)

Release the lock
Sleep on cond_var
When waken by the system, reacquire the lock and return

cond_signal(cond_var)

If at least 1 thread is sleeping on cond_var, wake 1 up
Otherwise, no effect

cond_broadcast(cond_var)

If at least 1 thread is sleeping on cond_var, wake everyone up
Otherwise, no effect

Previous slide Next slide Back to first slide View graphic version