title: Pool of threads implementation using pthreads in C++
body: <p>I'm having trouble in designing a program which has pool of threads. </p>
  
  <p>The main issue i'm stuck at is when a thread is done with work the parent has to wait on the threadId (this is how a parent waits on thread using pthread_join). Because we do not know which of the threads is going to finish first, i'm not able figure out a programatic way to solve the problem.</p>
  
  <p>Any explanation with a small snippet of code is appreciated.</p>
  
  <p>Thanks.</p>