--- jsr166/src/jsr166y/Phaser.java 2008/09/06 13:19:17 1.4 +++ jsr166/src/jsr166y/Phaser.java 2008/10/28 23:03:24 1.6 @@ -52,7 +52,7 @@ import java.lang.reflect.*; *
  • Barrier actions, performed by the task triggering a phase * advance while others may be waiting, are arranged by overriding * method onAdvance, that also controls termination. - * Overriding this method may be used to similar but more flecible + * Overriding this method may be used to similar but more flexible * effect as providing a barrier action to a CyclicBarrier. * *
  • Phasers may enter a termination state in which all @@ -102,10 +102,13 @@ import java.lang.reflect.*; * } * }.start(); * } + * + * doSomethingOnBehalfOfWorkers(); * phaser.arrive(); // allow threads to start - * int p = phaser.arriveAndDeregister(); // deregister self + * int p = phaser.arriveAndDeregister(); // deregister self ... + * p = phaser.awaitAdvance(p); // ... and await arrival * otherActions(); // do other things while tasks execute - * phaser.awaitAdvance(p); // wait for all tasks to arrive + * phaser.awaitAdvance(p); // awit final completion * } * *