title: Check if thread is finished in c++11?
body: <p>I need a way to know if the thread I am running is finished or not. If it is not finished it wait and if it is finished print a successful message.</p>
  
  <p>I don't find a method or something like that in c++11 from library thread.
  I can't set a global variable because inside thread I am using <code>execvp</code> and it does not return if successful.</p>
  
  <p>Is there any way to do that? A method or flag or anything else.</p>
  
  <p><code>Edit:</code> To make it clear I want to write a function that checks if thread is finished. </p>