title: pthreads : pthread_cond_signal() from within critical section
body: <p>I have the following piece of code in thread A, which blocks using <code>pthread_cond_wait()</code>  </p>
  
  <pre><code>pthread_mutex_lock(&amp;my_lock);     
  if ( false == testCondition )        
      pthread_cond_wait(&amp;my_wait,&amp;my_lock); 
  pthread_mutex_unlock(&amp;my_lock);
  </code></pre>
  
  <p>I have the following piece of code in thread B, which signals thread A</p>
  
  <pre><code>pthread_mutex_lock(&amp;my_lock);  
  testCondition = true;
  pthread_cond_signal(&amp;my_wait);
  pthread_mutex_unlock(&amp;my_lock);
  </code></pre>
  
  <p>Provided there are no other threads, would it make any difference if <code>pthread_cond_signal(&amp;my_wait)</code> is moved out of the critical section block as shown below ?</p>
  
  <pre><code>pthread_mutex_lock(&amp;my_lock);  
  testCondition = true;
  pthread_mutex_unlock(&amp;my_lock);
  pthread_cond_signal(&amp;my_wait);
  </code></pre>