33. データ競合なしプログラム
33 Copyright 2014 FUJITSU LIMITED
class LockNone extends Test {
LockNone(long amount) {
this.amount = amount;
}
void doIt() {
count++;
}
}
abstract class Test implements Runnable {
long count;
long time;
long amount;
public void run() {
count = 0;
long start = System.currentTimeMillis();
while (count < amount) {
doIt();
}
long end = System.currentTimeMillis();
time = (end-start);
}
}
排他なし