title: C++11 how to pass data to a running thread
body: <p>Say I use async to call a function in a separate thread and function waits for the input data (data comes with interval of 2-3sec). Can I pass the data to the function running in a separate thread? For example:</p>
  
  <pre><code> void f(int x) { std::cout &lt;&lt; "x: " &lt;&lt; x &lt;&lt; std::endl;}
  
   int main() {
       int x = get_x();
       std::async(std::launch::asunc, f, x);
       while(true) {
          x = get_x();
          //update x and sleep 2 sec
       }
   }
  </code></pre>