title: How can I wait for any/all pthreads to complete?
body: <p>I just want my main thread to wait for any and all my (p)threads to complete before exiting. </p>
  
  <p>The threads come and go a lot for different reasons, and I really don't want to keep track of all of them - I just want to know when they're all gone.</p>
  
  <p>wait() does this for child processes, returning ECHILD when there are no children left, however wait does not (appear to work with) (p)threads.</p>
  
  <p>I really don't want to go through the trouble of keeping a list of every single outstanding thread (as they come and go), then having to call pthread_join on each.</p>
  
  <p>As there a quick-and-dirty way to do this?</p>