title: std::thread - How to make main thread keep running and children branch off
body: <p>I'm working on a project where I want to create a thread that branches off the main thread, but does not block it until returned. What I mean by this is that I need the main thread to create the child thread, and the main thread keep working while the child thread goes its separate way (branching off). </p>
  
  <p>I've recreated a smaller-scale version of my code, for simplicity's sake:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  
  using namespace std;
  
  void wait() {
      std::this_thread::sleep_for(std::chrono::duration&lt;int, std::ratio&lt;1,1000&gt;&gt;(200));
  }
  
  void one() {
      static int x = 0;
      while(true) {
          cout &lt;&lt; "one" &lt;&lt; endl;
          wait();
      }
  }
  
  void two() {
      while(true) {
          cout &lt;&lt; "two" &lt;&lt; endl;
          wait();
      }
  }
  
  int main() {
      thread t1(one);
      thread t2(two);
  
      t1.join();
      t2.join();
  
      cout &lt;&lt; "Do stuff beyond here..";
  
      while(true) {
          cout &lt;&lt; "three" &lt;&lt; endl;
          wait();
      }
  
      return 0;
  }
  </code></pre>
  
  <p>My problem is that the threes don't start showing up until after the ones and twos have finished.. Is there any way around this? I've tried omitting the calls to <code>join</code>, but that only crashes the program.</p>
  
  <p>Any help would be greatly appreciated.</p>