211 |
|
private static final int phaseMask = 0x7fffffff; |
212 |
|
|
213 |
|
private static int unarrivedOf(long s) { |
214 |
< |
return (int)(s & ushortMask); |
214 |
> |
return (int) (s & ushortMask); |
215 |
|
} |
216 |
|
|
217 |
|
private static int partiesOf(long s) { |
266 |
|
private final AtomicReference<QNode> oddQ = new AtomicReference<QNode>(); |
267 |
|
|
268 |
|
private AtomicReference<QNode> queueFor(int phase) { |
269 |
< |
return (phase & 1) == 0? evenQ : oddQ; |
269 |
> |
return ((phase & 1) == 0) ? evenQ : oddQ; |
270 |
|
} |
271 |
|
|
272 |
|
/** |
274 |
|
* root if necessary. |
275 |
|
*/ |
276 |
|
private long getReconciledState() { |
277 |
< |
return parent == null? state : reconcileState(); |
277 |
> |
return (parent == null) ? state : reconcileState(); |
278 |
|
} |
279 |
|
|
280 |
|
/** |
441 |
|
if (par == null) { // directly trip |
442 |
|
if (casState |
443 |
|
(s, |
444 |
< |
trippedStateFor(onAdvance(phase, parties)? -1 : |
444 |
> |
trippedStateFor(onAdvance(phase, parties) ? -1 : |
445 |
|
((phase + 1) & phaseMask), parties))) { |
446 |
|
releaseWaiters(phase); |
447 |
|
break; |
502 |
|
if (unarrived == 0) { |
503 |
|
if (casState |
504 |
|
(s, |
505 |
< |
trippedStateFor(onAdvance(phase, parties)? -1 : |
505 |
> |
trippedStateFor(onAdvance(phase, parties) ? -1 : |
506 |
|
((phase + 1) & phaseMask), parties))) { |
507 |
|
releaseWaiters(phase); |
508 |
|
break; |
587 |
|
* @throws InterruptedException if thread interrupted while waiting |
588 |
|
* @throws TimeoutException if timed out while waiting |
589 |
|
*/ |
590 |
< |
public int awaitAdvanceInterruptibly(int phase, long timeout, TimeUnit unit) |
590 |
> |
public int awaitAdvanceInterruptibly(int phase, |
591 |
> |
long timeout, TimeUnit unit) |
592 |
|
throws InterruptedException, TimeoutException { |
593 |
|
if (phase < 0) |
594 |
|
return phase; |