title: Destructors and asynchronous tasks
body: <p>I have a class which calls an asynchronous task using <code>std::async</code> in his constructor for loading its content. ( I want the loading of the object done asynchronously )</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>void loadObject(Object* object)
  {
   // ... load object
  }
  
  Object::Object(): 
  {
      auto future = std::async(std::launch::async, loadObject, this);
  }
  </code></pre>
  
  <p>I have several instances of these objects getting created and deleted on my main thread, they can get deleted any time, even before their loading has finished.</p>
  
  <p>I'd like to know if it is dangerous to having object getting destroyed when it is still getting handled on another thread. And how can I stop the thread if the object gets destroyed ?</p>
  
  <p><strong>EDIT:</strong> The <code>std::future</code> destructor does not block my code with the VS2013's compiler that I am using due to a <a href="https://connect.microsoft.com/VisualStudio/feedback/details/810623" rel="nofollow">bug</a>.</p>