aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1999-08-18 03:48:37 +0000
committerTom Tromey <tromey@gcc.gnu.org>1999-08-18 03:48:37 +0000
commit212f5d3026a785d0962730023b2292b619bb835e (patch)
treee62ab147ca40a3da56bb8dc266b403a97b282c03 /libjava
parent1b12a13e40038d786ee0e3e757fe03905ec5eecb (diff)
downloadgcc-212f5d3026a785d0962730023b2292b619bb835e.zip
gcc-212f5d3026a785d0962730023b2292b619bb835e.tar.gz
gcc-212f5d3026a785d0962730023b2292b619bb835e.tar.bz2
natThread.cc (sleep): Turn 0 millis and 0 nanos into 1 nano.
* java/lang/natThread.cc (sleep): Turn 0 millis and 0 nanos into 1 nano. * include/quick-threads.h (_Jv_CondWait): Don't round to 0 inappropriately. From-SVN: r28742
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/include/quick-threads.h6
-rw-r--r--libjava/java/lang/natThread.cc3
3 files changed, 15 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index cd004eb..d4031dc 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+1999-08-17 Tom Tromey <tromey@cygnus.com>
+
+ * java/lang/natThread.cc (sleep): Turn 0 millis and 0 nanos into 1
+ nano.
+ * include/quick-threads.h (_Jv_CondWait): Don't round to 0
+ inappropriately.
+
1999-08-16 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
diff --git a/libjava/include/quick-threads.h b/libjava/include/quick-threads.h
index 3ce8ece..4626add 100644
--- a/libjava/include/quick-threads.h
+++ b/libjava/include/quick-threads.h
@@ -38,7 +38,11 @@ inline int
_Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
jlong millis, jint nanos)
{
- return coop_condition_variable_wait (cv, mu, millis * 1000 + nanos / 1000);
+ long micros = millis * 1000 + nanos / 1000;
+ // Don't round to 0 inappropriately.
+ if (! micros && (millis || nanos))
+ micros = 1;
+ return coop_condition_variable_wait (cv, mu, micros);
}
inline int
diff --git a/libjava/java/lang/natThread.cc b/libjava/java/lang/natThread.cc
index 1171911..9dc192e 100644
--- a/libjava/java/lang/natThread.cc
+++ b/libjava/java/lang/natThread.cc
@@ -214,6 +214,9 @@ java::lang::Thread::sleep (jlong millis, jint nanos)
if (millis < 0 || nanos < 0 || nanos > 999999)
_Jv_Throw (new IllegalArgumentException);
+ if (millis == 0 && nanos == 0)
+ ++nanos;
+
Thread *current = currentThread ();
if (current->isInterrupted ())
_Jv_Throw (new InterruptedException);