title: Java looping Threads using CyclicBarrier
body: <p>I have a program with this general structure:</p>
  
  <pre><code>init
  create CyclicBarrier
  initialise all threads, attaching to barrier
  *start all threads*
  wait for join
  display stats
  
  
  *start all threads*
  perform calculation
  await barrier
  </code></pre>
  
  <p>My problem is I need the threads' run() method to keep looping until a certain condition is met, but pausing after every iteration to let all threads synchronise.</p>
  
  <p>I've already tried attaching a Runnable method to the barrier, but this ends up requiring the recreation and restarting of each thread, which isn't a very good solution.</p>
  
  <p>I've also tried using the CyclicBarrier's reset() method, but this just seems to cause errors on the existing threads, even when executed after all threads have completed.</p>
  
  <p>My question is:</p>
  
  <p>-Is it possible to 'reset' a barrier and have all the barrier's threads follow the same conditions as they did before the first invocations of await()?</p>
  
  <p>-Or is there another method I should be using to achieve this?</p>
  
  <p>Thanks in advance</p>