86 |
|
* and best strategy for sharing knowledge about failures among |
87 |
|
* cooperating threads in the most common usage contexts of barriers. |
88 |
|
* |
89 |
– |
* <h3>Implementation Considerations</h3> |
90 |
– |
* <p>This implementation has the property that interruptions among newly |
91 |
– |
* arriving threads can cause as-yet-unresumed threads from a previous |
92 |
– |
* barrier cycle to return out as broken. This transmits breakage as |
93 |
– |
* early as possible, but with the possible byproduct that only some |
94 |
– |
* threads returning out of a barrier will realize that it is newly |
95 |
– |
* broken. (Others will not realize this until a future cycle.) |
96 |
– |
* |
97 |
– |
* |
98 |
– |
* |
89 |
|
* @since 1.5 |
90 |
|
* @spec JSR-166 |
91 |
|
* @revised $Date$ |
92 |
|
* @editor $Author$ |
93 |
|
* @see CountDownLatch |
94 |
|
* |
105 |
– |
* @fixme Is the above property actually true in this implementation? |
106 |
– |
* @fixme Should we have a timeout version of await()? |
95 |
|
* @author Doug Lea |
96 |
|
*/ |
97 |
|
public class CyclicBarrier { |
136 |
|
} |
137 |
|
|
138 |
|
/** |
139 |
< |
* Main barrier code, covering the various pilicies. |
139 |
> |
* Main barrier code, covering the various policies. |
140 |
|
*/ |
141 |
|
private int dowait(boolean timed, long nanos) throws InterruptedException, BrokenBarrierException, TimeoutException { |
142 |
|
lock.lock(); |
193 |
|
throw new TimeoutException(); |
194 |
|
} |
195 |
|
|
196 |
< |
if (broken == generation) |
196 |
> |
if (broken == g) |
197 |
|
throw new BrokenBarrierException(); |
198 |
|
|
199 |
|
} |