classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] RFC: VMThread.sleep mauve fix


From: Christian Thalinger
Subject: [cp-patches] RFC: VMThread.sleep mauve fix
Date: Tue, 25 Oct 2005 01:10:48 +0200

Hi!

Just noticed that the default implementation in GNU classpath has
problems with gnu.testlet.java.lang.Thread.sleep.  This patch should fix
the issue, without breaking anything.

TWISTI


2005-10-25  Christian Thalinger  <address@hidden>

        * vm/reference/java/lang/VMThread.java (sleep): Don't round     
        ms and pass ns to Object.wait, fixes mauve test.


Index: vm/reference/java/lang/VMThread.java
===================================================================
RCS file: 
/ahome/cacao/cacaocvs/cacao/src/lib/vm/reference/java/lang/VMThread.java,v
retrieving revision 1.1
diff -u -3 -p -r1.1 VMThread.java
--- vm/reference/java/lang/VMThread.java        29 Sep 2005 13:06:21 -0000      
1.1
+++ vm/reference/java/lang/VMThread.java        24 Oct 2005 23:05:51 -0000
@@ -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,7 +415,7 @@ final class VMThread
        {
          while (true)
            {
-             vt.wait(ms);
+             vt.wait(ms, ns);
              now = System.currentTimeMillis();
              if (now >= end)
                break;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]