title: Boost Interthread Communication
body: <p>I have to implement boost inter-thread communication. Consider following code:</p>
  
  <pre><code>#include &lt;boost/thread/thread.hpp&gt;
  #include &lt;Windows.h&gt;
  void threadA()
  {
      while(true)
      {
          std::cout &lt;&lt; "From thread A" &lt;&lt; std::endl;
          Sleep(3000); //pretend to do the work
      }
  }
  
  void threadB()
  {
      while(true)
      {
          std::cout &lt;&lt; "From thread B" &lt;&lt; std::endl;
          Sleep(3000); //pretend to do the work
      }
  }
  
  int main()
  {
      boost::thread *th1 = new boost::thread(&amp;threadA);
      boost::thread *th2 = new boost::thread(&amp;threadB);
      th1-&gt;join();
      th2-&gt;join();
      delete th1;
      delete th2;
  }
  </code></pre>
  
  <p>If I run the above code, it will spawn both thread. What I want to do is start the <code>threadA</code> and send some message to <code>threadB</code>, which upon receiving will start the thread. Or More Generally, How can I handle the communication if both of these thread run independently ?</p>