2005-11-01 Christian Thalinger <twisti@complang.tuwien.ac.at>
authortwisti <none@none>
Tue, 1 Nov 2005 18:32:53 +0000 (18:32 +0000)
committertwisti <none@none>
Tue, 1 Nov 2005 18:32:53 +0000 (18:32 +0000)
* vm/reference/java/lang/VMThread.java (sleep): Don't round
ms and pass ns to Object.wait, fixes mauve test.

src/lib/vm/reference/java/lang/VMThread.java

index 9373705413e57c0e4b95b10ce5a6cfb94eaee5f4..8e9615212cc5955b9863da339130928e8e32e312 100644 (file)
@@ -391,15 +391,11 @@ final class VMThread
      */
     static void sleep(long ms, int ns) throws InterruptedException
     {
-
-      // Round up
-      ms += (ns != 0) ? 1 : 0;
-
       // Note: JDK treats a zero length sleep is like Thread.yield(),
       // without checking the interrupted status of the thread.
       // It's unclear if this is a bug in the implementation or the spec.
       // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203
-      if (ms == 0)
+      if (ms == 0 && ns == 0)
        {
          if (Thread.interrupted())
            throw new InterruptedException();
@@ -419,11 +415,12 @@ final class VMThread
        {
          while (true)
            {
-             vt.wait(ms);
+             vt.wait(ms, ns);
              now = System.currentTimeMillis();
              if (now >= end)
                break;
              ms = end - now;
+             ns = 0;
            }
        }
     }