http://bbergeron.i2p/posts/2024-02-01_disambiguating-pthread_cond_wait.html
Hold on, if a waiting thread atomically unlocks his mutex before
waiting for a condition, how can it atomically retrieve control over the
mutex after the condition is signaled, if we can’t unlock a mutex and
signal a condition atomically? The answer turned out to be simple; after
a condition is met, the thread simply waits to get its mutex back, as if pthread_cond_wait had turned into pthread_mutex_lock .