1 |
|
/* |
2 |
+ |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
+ |
* Expert Group and released to the public domain, as explained at |
4 |
+ |
* http://creativecommons.org/licenses/publicdomain |
5 |
+ |
*/ |
6 |
+ |
/* |
7 |
|
* @test |
8 |
|
* @summary basic safety and liveness of ReentrantLocks, and other locks based on them |
9 |
|
*/ |
183 |
|
private volatile int readBarrier; |
184 |
|
final int loop(int n) { |
185 |
|
int sum = 0; |
186 |
< |
int x = 0;; |
186 |
> |
int x = 0; |
187 |
|
while (n-- > 0) { |
188 |
|
int r1 = readBarrier; |
189 |
|
x = setValue(LoopHelpers.compute1(getValue())); |
199 |
|
private static class BuiltinLockLoop extends LockLoop { |
200 |
|
final int loop(int n) { |
201 |
|
int sum = 0; |
202 |
< |
int x = 0;; |
202 |
> |
int x = 0; |
203 |
|
while (n-- > 0) { |
204 |
|
synchronized(this) { |
205 |
|
x = setValue(LoopHelpers.compute1(getValue())); |