title: How to execute a callback in the original thread in C++?
body: <p>In C++, can I execute a function in a thread, and pass to this function a lambda that will be executed in the original thread ?</p>
  
  <pre><code>class A
  {
      void fA()
      {
          // thread 1
          boost::thread t(boost::bind(&amp;A::fA, this, [=]() { /* code to execute in thread 1 */  }
      }
  
      void fB(const std::function&lt;void()&gt; &amp;callback)
      {
          // thread 2
  
          how to execute 'callback' in the original thread (thread 1) ?
      }    
  }
  </code></pre>
  
  <p>Thanks in advance.</p>