natThread.cc (sleep): Turn 0 millis and 0 nanos into 1 nano.
authorTom Tromey <tromey@cygnus.com>
Wed, 18 Aug 1999 03:48:37 +0000 (03:48 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 18 Aug 1999 03:48:37 +0000 (03:48 +0000)
* 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

libjava/ChangeLog
libjava/include/quick-threads.h
libjava/java/lang/natThread.cc

index cd004eb88bfcbc1f14fb3f5e766744879bfd4fc0..d4031dc3a81f83f5e52a3307c57b648dd890999b 100644 (file)
@@ -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.
index 3ce8ece216834c217b22550d0b23e4ce171f17e9..4626add02f9fe7b12ccde3a830c6590a30bf94b0 100644 (file)
@@ -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
index 117191133a8652f24e12bcfd7de3e4fe26bff578..9dc192e12c4ff3182d43100d0996a2a306ece9d6 100644 (file)
@@ -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);