title: What happens to a thread calling pthread_cond_signal?
body: <p>When a thread calls <code>pthread_cond_signal</code>, one of the threads waiting on the condition will resume its execution. But what happens to the calling thread? Does it waits for the called thread to release the mutex and then it resumes?</p>
  
  <p>For example, the waiting thread:</p>
  
  <pre class="lang-c prettyprint-override"><code>pthread_mutex_lock(&amp;mut);
  // ...
  pthread_cond_wait(&amp;cond, &amp;mut);
  // ...
  pthread_mutex_unlock(&amp;mut);
  </code></pre>
  
  <p>And the signaling thread:</p>
  
  <pre class="lang-c prettyprint-override"><code>pthread_mutex_lock(&amp;mut);
  // ...
  pthread_cond_signal(&amp;cond);
  // ... has work to finish
  pthread_mutex_unlock(&amp;mut);
  </code></pre>
  
  <p>In this case, how can the signaling thread continue its work if the waiting thread has taken over the mutex?</p>