title: How to make some threads do work before other threads?
body: <p>Let's say I have 4 threads that should read from an array and 4 threads that should update something inside of an array. How should one go about making the read threads do all their work before the update threads but with calling all 8 at the same time.</p>
  <pre><code>thread t1 = thread(func,args);//READ
  thread t2 = thread(func2,args);//WRITE
  thread t3 = thread(func,args);//READ
  thread t4 = thread(func,args);//READ
  thread t5 = thread(func,args);//READ
  thread t6 = thread(func2,args);//WRITE
  thread t7 = thread(func2,args);//WRITE
  thread t8 = thread(func2,args);//WRITE
  </code></pre>
  <p>and after that let's say I do join() on all of them.
  To clarify, I want functions to make the priority happen but I'm not sure how to implement that.</p>
  <p>The main problem I have is that even if I use the condition_variables they all start at the same time so at least some of the write threads would still go off.</p>