title: C++ Get the return value from a threaded function later
body: <p>Is it possible to not wait for a return value from a threaded function? Such as checking later if the value ever returned and do something else while that function is executing? I mean it's not really multi-threading if you have to wait for the function to return because you can just straight up call the function then.</p>
  
  <pre><code>#include &lt;thread&gt;
  #include &lt;future&gt;
  
  int func_1(int x)
  { 
      return x; //Assume this takes several seconds to complete
  }
  
  int main()
  {
        auto future = std::async(func_1, 2);
  
        int number = future.get(); //Whole program waits for this
  
        //More code later
  
        while(!number) //Check if number ever returned?
        {
              //Wait for it or assume some error/default
        }
        return 0;
  }
  </code></pre>