volatile boolean stop = false;
byte counter = 0;
entropySpinner() { start(); }
- public void run() { while (!stop) counter++; }
+ public void run() {
+ while (true) {
+ // without this synchronization, GCJ will over-optimize this loop into an infinite loop. Argh.
+ synchronized(this) {
+ counter++;
+ if (stop) return;
+ }
+ }
+ }
}
static {