diff options
author | Archie Cobbs <archie@dellroad.org> | 2005-01-02 17:29:33 +0000 |
---|---|---|
committer | Archie Cobbs <archie@dellroad.org> | 2005-01-02 17:29:33 +0000 |
commit | 62f3192d5d25296ae1eb6f5559ca49710fa3cac8 (patch) | |
tree | dd516cf6750b95d396284677cb13d7ff1d6639a7 /vm | |
parent | 3074936ca2235cacadeec02fdd3f4a4b0b69fd6f (diff) | |
download | classpath-62f3192d5d25296ae1eb6f5559ca49710fa3cac8.tar.gz |
* vm/reference/java/lang/VMThread.java (sleep()): revert behavior
of sleep(0,0) to previous, where we check for InterruptedException.
Diffstat (limited to 'vm')
-rw-r--r-- | vm/reference/java/lang/VMThread.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/vm/reference/java/lang/VMThread.java b/vm/reference/java/lang/VMThread.java index 60de9580f..bfe31ffa4 100644 --- a/vm/reference/java/lang/VMThread.java +++ b/vm/reference/java/lang/VMThread.java @@ -367,12 +367,6 @@ final class VMThread * because some other thread may be active. So don't expect real-time * performance. * - * <p> - * A zero length sleep is equivalent to <code>Thread.yield()</code>. - * This is simply for compatibility with Sun's JDK. See also - * <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203">JDK - * Bug #6213203</a>. - * * @param ms the number of milliseconds to sleep. * @param ns the number of extra nanoseconds to sleep (0-999999) * @throws InterruptedException if the Thread is (or was) interrupted; @@ -384,10 +378,14 @@ final class VMThread // Round up ms += (ns != 0) ? 1 : 0; - // JDK compatibility: sleep(0) is equivalent to Thread.yield() + // 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) { - Thread.yield(); + if (Thread.interrupted()) + throw new InterruptedException(); return; } |