This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

hrm...


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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]