hrm...
Adam Megacz
gcj@lists.megacz.com
Fri Jul 19 18:59:00 GMT 2002
In TinySSL, I generate some entropy like this:
static class entropySpinner extends Thread {
volatile boolean stop = false;
byte counter = 0;
entropySpinner() { start(); }
public void run() {
System.out.println("start!");
while (!stop) counter++;
System.out.println("stop!");
}
}
entropySpinner[] spinners = new entropySpinner[10];
for(int i=0; i<spinners.length; i++) spinners[i] = new entropySpinner();
try { Thread.sleep(100); } catch (Exception e) { }
for(int i=0; i<spinners.length; i++) {
spinners[i].stop = true;
randpool[i] = spinners[i].counter;
}
But for some reason, under GCJ, the spinners keep spinning... the
thread never stops. Could it be possible that GCJ is overaggressively
optimizing out the while loop's test and turning it into an infinite
loop?
- a
--
Sick of HTML user interfaces?
www.xwt.org
Today's example of Greenspanese: "[the 1990's] arguably engendered an
outsized increase in opportunities for avarice"
More information about the Java
mailing list