This question is regarding the pthread tutorial in llnl. Say there are three threads.
Thread 1:
pthread_mutex_lock(&mutex)
do_s
There is no guarantee. Returning from pthread_cond_wait() should be treated as implying that the condition might have changed, not that it definitely has - so you need to re-check the condition, and may need to wait again. This is exactly why pthread_cond_wait() should be called within a loop that checks the condition.