232 |
|
* |
233 |
|
* Nearly all of these mechanics are carried out in methods |
234 |
|
* acquireWrite and acquireRead, that, as typical of such code, |
235 |
< |
* sprawl out because actions and retries rely on consitent sets |
235 |
> |
* sprawl out because actions and retries rely on consistent sets |
236 |
|
* of locally cached reads. |
237 |
|
* |
238 |
|
* As noted in Boehm's paper (above), sequence validation (mainly |
331 |
|
* @return a stamp that can be used to unlock or convert mode |
332 |
|
*/ |
333 |
|
public long writeLock() { |
334 |
< |
long s, next; // bypass acquireWrite in fully onlocked case only |
334 |
> |
long s, next; // bypass acquireWrite in fully unlocked case only |
335 |
|
return ((((s = state) & ABITS) == 0L && |
336 |
|
U.compareAndSwapLong(this, STATE, s, next = s + WBIT)) ? |
337 |
|
next : acquireWrite(false, 0L)); |
403 |
|
* @return a stamp that can be used to unlock or convert mode |
404 |
|
*/ |
405 |
|
public long readLock() { |
406 |
< |
long s, next; // bypass acquireRead on fully onlocked case only |
406 |
> |
long s, next; // bypass acquireRead on fully unlocked case only |
407 |
|
return ((((s = state) & ABITS) == 0L && |
408 |
|
U.compareAndSwapLong(this, STATE, s, next = s + RUNIT)) ? |
409 |
|
next : acquireRead(false, 0L)); |