/[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.8 by mark, Sat Jul 2 20:33:08 2005 UTC revision 1.9 by twisti, Tue Nov 1 18:30:09 2005 UTC
# Line 376  final class VMThread Line 376  final class VMThread
376       */       */
377      static void sleep(long ms, int ns) throws InterruptedException      static void sleep(long ms, int ns) throws InterruptedException
378      {      {
   
       // Round up  
       ms += (ns != 0) ? 1 : 0;  
   
379        // Note: JDK treats a zero length sleep is like Thread.yield(),        // Note: JDK treats a zero length sleep is like Thread.yield(),
380        // without checking the interrupted status of the thread.        // without checking the interrupted status of the thread.
381        // 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.
382        // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203        // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203
383        if (ms == 0)        if (ms == 0 && ns == 0)
384          {          {
385            if (Thread.interrupted())            if (Thread.interrupted())
386              throw new InterruptedException();              throw new InterruptedException();
# Line 404  final class VMThread Line 400  final class VMThread
400          {          {
401            while (true)            while (true)
402              {              {
403                vt.wait(ms);                vt.wait(ms, ns);
404                now = System.currentTimeMillis();                now = System.currentTimeMillis();
405                if (now >= end)                if (now >= end)
406                  break;                  break;
407                ms = end - now;                ms = end - now;
408                  ns = 0;
409              }              }
410          }          }
411      }      }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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