Zephyr Condition Variables: Couple Predicate Changes to Mutex Release and Recheck
Protect the shared predicate with a mutex, test it while holding that mutex, and wait in a loop that rechecks it after every return. A condition-variable signal tells a waiter to reconsider shared state. It does not reserve an item or prove that the state is still suitable when the waiter regains the mutex. This…