Fix for the pthread_cond_wait