title: asynchronous function call C++0x
body: <p>I am testing on the std::async function with the code from <a href="http://www.justsoftwaresolutions.co.uk/threading/multithreading-in-c++0x-part-8-futures-and-promises.html" rel="noreferrer">http://www.justsoftwaresolutions.co.uk/threading/multithreading-in-c++0x-part-8-futures-and-promises.html</a></p>
  
  <pre><code>int calculate_the_answer_to_LtUaE(){
      sleep(5);
  cout &lt;&lt; "Aaa" &lt;&lt; endl;
  }
  
     std::future&lt;int&gt; the_answer=std::async(calculate_the_answer_to_LtUaE);
     the_answer.get();
     cout &lt;&lt; "finish calling" &lt;&lt; endl;
     sleep(10000);
  </code></pre>
  
  <p>I need to call the_answer.get() to invoke calculate_the_answer_to_LtUaE() and get the Aaa printed on the screen. If I commented out the_answer.get() line, I would not get anything printed. Is this the intended behaviour of the std::async function or I am doing something wrong here? This is because I thought the_answer.get() is used to wait for the function to complete and to retrieve the result. </p>
  
  <p>Thanks.</p>