libgcj: Thread.sleep() on Linux

Bryce McKinlay bryce@albatross.co.nz
Mon Apr 19 21:04:00 GMT 1999


Thread.sleep() doesn't seem to do anything on Linux/glibc 2.0.7. The
following code will print one dot per second when run in java, but will
run through instantly using gcj:

public class SleepTest
{
  public static void main(String args[])
  {
    System.out.print("Sleeping");
    for (int i=0; i<5; i++) {
      System.out.print(".");
      try
        {
          Thread.sleep(1000);
 }
      catch (InterruptedException x)
        {
   System.err.println(x);
 }
    }
    System.out.println("Done");
  }
}

regards

  [ bryce ]




More information about the Java mailing list