Skip to content

Commit 620703e

Browse files
author
Bruce Eckel
committed
eliminated volatile
1 parent 8c4b4e7 commit 620703e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

concurrent/Summing.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
import onjava.Timer;
88

99
public class Summing {
10-
static volatile long result;
1110
static void timeTest(String id, long checkValue,
1211
LongSupplier operation) {
1312
System.out.print(id + ": ");
1413
Timer timer = new Timer();
15-
// Prevent optimization:
16-
result = operation.getAsLong();
14+
long result = operation.getAsLong();
1715
if(result == checkValue)
1816
System.out.println(timer.duration() + "ms");
1917
else

0 commit comments

Comments
 (0)