title: Notify caller that a thread has finished
body: <p>I am trying to use the multithreading features in the C++11 standard library and have the following situation envisioned.</p>
  
  <p>I have a parent class which maintains a queue of thread. So something like:</p>
  
  <pre><code>std::queue&lt;MyMTObject *&gt;  _my_threads;
  </code></pre>
  
  <p>The class <code>MyMTObject</code> contains the <code>std::thread</code> object.
  The queue has a fixed size of 5 and the class initially starts with the queue being full.</p>
  
  <p>As I have jobs to process I launch threads and I remove them from the queue. What I would like is to get a notification when the job is finished along with the pointer to the <code>MyMTObject</code>, so that I can reinsert them into the queue and make them available again.</p>
  
  <p>I have basically 2 questions:</p>
  
  <p>1: Is this a sound idea? I know I have not specified specifics but broadly speaking. I will, of course, control all access to the queue with a mutex.</p>
  
  <p>2: Is there a way to implement this notification mechanism without using external libraries like <code>Qt</code> or <code>boost</code>.</p>
  
  <p>For duplicates, I did look on the site but could not find anything that was suitable to manage a collection of threads.</p>