Wait for the condition to be signalled. Signal variables need to be guarded by a mutex which needs to be given to this function as an argument, see the man page of pthread_cond_wait for a description of the mechanisms.

The mutex is assumed held at the entry to this function but is released upon exit.