/[classpath]/classpath/vm/reference/java/lang/VMThread.java
ViewVC logotype

Diff of /classpath/vm/reference/java/lang/VMThread.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.4 by gnu_andrew, Tue Aug 2 20:12:48 2005 UTC revision 1.2.2.5 by gnu_andrew, Wed Nov 2 00:44:15 2005 UTC
# Line 379  final class VMThread Line 379  final class VMThread
379       */       */
380      static void sleep(long ms, int ns) throws InterruptedException      static void sleep(long ms, int ns) throws InterruptedException
381      {      {
   
       // Round up  
       ms += (ns != 0) ? 1 : 0;  
   
382        // Note: JDK treats a zero length sleep is like Thread.yield(),        // Note: JDK treats a zero length sleep is like Thread.yield(),
383        // without checking the interrupted status of the thread.        // without checking the interrupted status of the thread.
384        // It's unclear if this is a bug in the implementation or the spec.        // It's unclear if this is a bug in the implementation or the spec.
385        // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203        // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203
386        if (ms == 0)        if (ms == 0 && ns == 0)
387          {          {
388            if (Thread.interrupted())            if (Thread.interrupted())
389              throw new InterruptedException();              throw new InterruptedException();
# Line 407  final class VMThread Line 403  final class VMThread
403          {          {
404            while (true)            while (true)
405              {              {
406                vt.wait(ms);                vt.wait(ms, ns);
407                now = System.currentTimeMillis();                now = System.currentTimeMillis();
408                if (now >= end)                if (now >= end)
409                  break;                  break;
410                ms = end - now;                ms = end - now;
411                  ns = 0;
412              }              }
413          }          }
414      }      }

Legend:
Removed from v.1.2.2.4  
changed lines
  Added in v.1.2.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26