1 |
|
/* |
2 |
– |
* @test |
3 |
– |
* @synopsis multiple threads using a single lock |
4 |
– |
*/ |
5 |
– |
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
< |
* Expert Group and released to the public domain. Use, modify, and |
4 |
< |
* redistribute this code in any way without acknowledgement. |
3 |
> |
* Expert Group and released to the public domain, as explained at |
4 |
> |
* http://creativecommons.org/licenses/publicdomain |
5 |
|
*/ |
6 |
|
|
7 |
|
import java.util.concurrent.*; |
79 |
|
if (k > 0) { |
80 |
|
x = v; |
81 |
|
while (k-- > 0) |
82 |
< |
x = LoopHelpers.compute4(x); |
82 |
> |
x = LoopHelpers.compute6(x); |
83 |
|
v = x; |
84 |
|
} |
85 |
|
else x = sum + 1; |
88 |
|
if ((x += readBarrier) == 0) |
89 |
|
++readBarrier; |
90 |
|
for (int l = x & 7; l > 0; --l) |
91 |
< |
sum += LoopHelpers.compute4(sum); |
91 |
> |
sum += LoopHelpers.compute6(sum); |
92 |
|
} |
93 |
|
barrier.await(); |
94 |
|
result += sum; |