Waiting until work is available
A worker locks a mutex, checks its shared-state condition, and waits when no work exists: `mtx_lock(&L->mtx); while (!L->finished && (L->accounted == L->iteration)) life_wait(&L->acco, &L->mtx); life_account(L); cnd_signal(&L->upda); mtx_unlock(&L->mtx);`. Here, `L->acco` is a cnd_t condition variable identifying the accounting condition; the Boolean expression remains the condition that must be checked. section 18.5
cnd_t is the C standard threads type for coordinating conditional dependencies between threads. A condition variable gives a thread a place to wait until another thread signals that shared state may have changed; it does not store the condition expression itself. section 18.7 section 18.5
Always place a wait inside a loop that checks the predicate again after return. A wait can return because of a timeout or before the condition expression has changed; blocking on cnd_t or mtx_t also frees processing resources. section 18.5 section 18.6
