A condition variable is a synchronization object that lets a thread wait until shared state may satisfy a predicate. It accompanies a mutex: lock the mutex, test the predicate, and wait while the predicate remains false. TAKEAWAY: returning from a wait does not prove that the predicate is true; check it again. section 18.5
Coordinating game threads
An accounting thread waits while L->accounted == L->iteration; an update thread waits while L->accounted < L->iteration; and a drawing thread waits while no new iteration or input change exists. Each uses its own condition variable—acco, upda, or draw—while sharing L->mtx. The update thread signals acco and draw after advancing the iteration.






