title: What exactly is join() in Boost::thread? (C++)
body: <p>In Java, I would do something like:</p>
  
  <pre><code>Thread t = new MyThread();
  t.start();
  </code></pre>
  
  <p>I start thread by calling start() method. So later I can do something like:</p>
  
  <pre><code>for (int i = 0; i &lt; limit; ++i)
  {
      Thread t = new MyThread();
      t.start();
  }
  </code></pre>
  
  <p>To create a group of threads and execute the code in run() method. </p>
  
  <p>However, in C++, there's no such thing as start() method. Using Boost, if I want a thread to start running, I have to call the join() method in order to make a thread running. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/thread.hpp&gt;
  
  class Worker
  {
  public:
      Worker() 
      {
          // the thread is not-a-thread until we call start()
      }
  
      void start(int N)
      {
          m_Thread = boost::thread(&amp;Worker::processQueue, this, N);
      }
  
      void join()
      {
          m_Thread.join();
      }
  
      void processQueue(unsigned N)
      {
          float ms = N * 1e3;
          boost::posix_time::milliseconds workTime(ms);
  
          std::cout &lt;&lt; "Worker: started, will work for "
                    &lt;&lt; ms &lt;&lt; "ms"
                    &lt;&lt; std::endl;
  
          // We're busy, honest!
          boost::this_thread::sleep(workTime);
          std::cout &lt;&lt; "Worker: completed" &lt;&lt; std::endl;
      }
  
  private:
  
      boost::thread m_Thread;
  };
  
  int main(int argc, char* argv[])
  {
      std::cout &lt;&lt; "main: startup" &lt;&lt; std::endl;
  
      Worker worker, w2, w3, w5;
  
      worker.start(3);
      w2.start(3);
      w3.start(3);
      w5.start(3);
  
      worker.join();
      w2.join();
      w3.join();
      w5.join();
      for (int i = 0; i &lt; 100; ++i)
      {
          Worker w;
          w.start(3);
          w.join();
      }
      //std::cout &lt;&lt; "main: waiting for thread" &lt;&lt; std::endl;    
  
      std::cout &lt;&lt; "main: done" &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  
  <p>On the code above, the for loop to create 100 threads, normally I must use a boost::thread_group to add the thread function, and finally run all with join_all(). However, I don't know how to do it with thread function putting in a class which uses various class members.</p>
  
  <p>On the other hand, the loop above will not behave like the loop in Java. It will make each thread execute sequentially, not all at once like the other separated threads, whose own join() is called. </p>
  
  <p>What is join() in Boost exactly? Also please help me to create a group of threads which share the same class.</p>