title: How do I use while true in threads?
body: <p>Can anyone point me at the thing I try to do in this code, because <code>SecondLoop</code> thread is unreachable at all? It becomes reachable only if I remove <code>while(true)</code> loop.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  
  using namespace std;
  
  void Loop() {
      while(true) {
          (do something)
      }
  }
  
  void SecondLoop() {
      while(true) {
          (do something)
      }
  }
  
  int main() {
      thread t1(Loop);
      t1.join();
  
      thread t2(SecondLoop);
      t2.join(); // THIS THREAD IS UNREACHABLE AT ALL!
  
      return false;
  }
  </code></pre>
  
  <p>The reason why I use multithreading is because I need to get two loops running at the same time.</p>