title: Reuse the same thread
body: <p>I am writing a program for an assignment,which implements matrix multiplication between two given arrays,using threads.</p>
  
  <p>I must give the number of threads i want to use as a command line argument and if the number of them is smaller than the number of lines of the first array,reuse some the same threads until the whole job is done.</p>
  
  <p>I have managed to make it work but only using a thread for each row of the array.
  For example if a have a 5x5 multiplication and use less than 5 threads i take a segmentation fault,which makes sense.</p>
  
  <p>My question is:How can i reuse a thread after this thread has finished its job?
  In the previous example i mean that if i want to use 2 threads for a 5x5 my program should work like this:</p>
  
  <p>thread 1->line 1</p>
  
  <p>thread 2->line 2</p>
  
  <p>thread 2->line 3</p>
  
  <p>thread 1->line 4</p>
  
  <p>etc.</p>