title: Setting a process's exit status from a pthread
body: <p>I have a process with one "main" thread and several child threads.  Every child thread is in a detached state because the return status is unimportant to the main thread.  </p>
  
  <p>To close the program, the main thread requests all other threads stop, then the main thread <code>pthread_exit</code>s.  The program then quits when the last child thread quits.  </p>
  
  <p>The problem is the exit status of my application is always 0 when terminated in this way.  </p>
  
  <p>However, sometimes I want to exit with an error (exit value of 1).  Is there any way I can have the main thread set the exit status flag before it <code>pthread_exit</code>s?</p>