title: Signal from pthread to main
body: <pre><code>pthread_t thread_id;
  while(1) {
     if(counter &lt; 3) {
        // do something
        pthread_create( &amp;thread_id , NULL , handle_me, (void*)arg);
     }
     else {
        // wait for counter to be changed 
        // pthreads will be changing the counter 
        // when changed, go back to beginning of loop 
        counter++;
     }
  }
  </code></pre>
  
  <p>i am trying to achieve the following: signal from a <code>pthread</code> to main. 
  what options do i have ? </p>
  
  <p>counter is protected by a <code>mutex</code> when changed in threads.</p>