As we know, pthread_cond_wait(cond, mutex) first unlock the mutex and wait. When it is waked up on condition variable, it has to lock the mutex.
Now my question is: what if it's waked up but found the mutex is already locked by someone else? What shall it do? Will it go back to sleep(wait) or just give up?