title: Simultaneous Threads in C++ using <thread>
body: <p>I have been looking around and I am not sure why is this happening. I've seen lots of Tuts related to using threads on Linux but not much on what I am sharing right now.</p>
  <p>Code:</p>
  <pre><code>int j = 0;
  while(j &lt;= 10)
  {
      myThreads[j] = std::thread(task, j);
      myThreads[j].join();
      j+=1;
  }
  </code></pre>
  <p>So I am simply trying to create 10 threads and execute them all.
  The task is pretty simple and it's been dealt with pretty well but the problem is that not the whole threads are being executed.</p>
  <p><em><strong>It's executing only 1 thread and it's waiting for it to finish then executing the other one etc...</strong></em></p>
  <p>PS: I know that the main function will quit after activating those threads but I read about this and I am sure I can fix it in many ways.</p>
  <p>So I want to execute all those threads simultaneously.</p>
  <p>Thanks a lot in advance,
  MarioAda.</p>