84 |
|
* |
85 |
|
* <p><b>Sample usages:</b> |
86 |
|
* |
87 |
< |
* <p>A Phaser may be used instead of a {@code CountdownLatch} to control |
87 |
> |
* <p>A Phaser may be used instead of a {@code CountDownLatch} to control |
88 |
|
* a one-shot action serving a variable number of parties. The typical |
89 |
|
* idiom is for the method setting this up to first register, then |
90 |
|
* start the actions, then deregister, as in: |
108 |
|
* int p = phaser.arriveAndDeregister(); // deregister self ... |
109 |
|
* p = phaser.awaitAdvance(p); // ... and await arrival |
110 |
|
* otherActions(); // do other things while tasks execute |
111 |
< |
* phaser.awaitAdvance(p); // awit final completion |
111 |
> |
* phaser.awaitAdvance(p); // await final completion |
112 |
|
* } |
113 |
|
* </pre> |
114 |
|
* |
195 |
|
* However, to efficiently maintain atomicity, these values are |
196 |
|
* packed into a single (atomic) long. Termination uses the sign |
197 |
|
* bit of 32 bit representation of phase, so phase is set to -1 on |
198 |
< |
* termination. Good performace relies on keeping state decoding |
198 |
> |
* termination. Good performance relies on keeping state decoding |
199 |
|
* and encoding simple, and keeping race windows short. |
200 |
|
* |
201 |
|
* Note: there are some cheats in arrive() that rely on unarrived |
541 |
|
|
542 |
|
/** |
543 |
|
* Awaits the phase of the barrier to advance from the given |
544 |
< |
* value, or returns immediately if argumet is negative or this |
544 |
> |
* value, or returns immediately if argument is negative or this |
545 |
|
* barrier is terminated, or throws InterruptedException if |
546 |
|
* interrupted while waiting. |
547 |
|
* @param phase the phase on entry to this method |