From cc4edb3e61c5fd76f753ad4c0f3ae4631acc42a0 Mon Sep 17 00:00:00 2001 From: twisti Date: Fri, 25 Jun 2004 10:15:56 +0000 Subject: [PATCH] - pass nanos to sleepThread - #ifdef __GNUC__ for #warning --- nat/Thread.c | 32 ++++++++++++++++++++++++-------- src/native/vm/VMThread.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/nat/Thread.c b/nat/Thread.c index ad646efa5..836546f31 100644 --- a/nat/Thread.c +++ b/nat/Thread.c @@ -28,7 +28,7 @@ Changes: Joseph Wenninger - $Id: Thread.c 1173 2004-06-16 14:56:18Z jowenn $ + $Id: Thread.c 1206 2004-06-25 10:15:56Z twisti $ */ @@ -185,13 +185,26 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, ja * Method: sleep * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2) +JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 nanos) { - if (runverbose) - log_text("java_lang_VMThread_sleep called"); + if (millis < 0) { + *exceptionptr = + new_exception_message(string_java_lang_IllegalArgumentException, + "timeout value is negative"); + + return; + } + + if (nanos < 0 || nanos > 999999) { + *exceptionptr = + new_exception_message(string_java_lang_IllegalArgumentException, + "nanosecond timeout value out of range"); + + return; + } #if defined(USE_THREADS) - sleepThread(millis); + sleepThread(millis, nanos); #endif } @@ -207,10 +220,13 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMTh log_text("java_lang_VMThread_start called"); #if defined(USE_THREADS) +#if defined(__GNUC__) #warning perhaps it would be better to always work with the vmthread structure in the thread code (jowenn) - if (this->thread->vmThread==0) - this->thread->vmThread=this; - startThread((thread*)(this->thread)); +#endif + if (this->thread->vmThread == 0) + this->thread->vmThread = this; + + startThread((thread *) (this->thread)); #endif } diff --git a/src/native/vm/VMThread.c b/src/native/vm/VMThread.c index 593b5ad88..830f82f64 100644 --- a/src/native/vm/VMThread.c +++ b/src/native/vm/VMThread.c @@ -28,7 +28,7 @@ Changes: Joseph Wenninger - $Id: VMThread.c 1173 2004-06-16 14:56:18Z jowenn $ + $Id: VMThread.c 1206 2004-06-25 10:15:56Z twisti $ */ @@ -185,13 +185,26 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, ja * Method: sleep * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2) +JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 nanos) { - if (runverbose) - log_text("java_lang_VMThread_sleep called"); + if (millis < 0) { + *exceptionptr = + new_exception_message(string_java_lang_IllegalArgumentException, + "timeout value is negative"); + + return; + } + + if (nanos < 0 || nanos > 999999) { + *exceptionptr = + new_exception_message(string_java_lang_IllegalArgumentException, + "nanosecond timeout value out of range"); + + return; + } #if defined(USE_THREADS) - sleepThread(millis); + sleepThread(millis, nanos); #endif } @@ -207,10 +220,13 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMTh log_text("java_lang_VMThread_start called"); #if defined(USE_THREADS) +#if defined(__GNUC__) #warning perhaps it would be better to always work with the vmthread structure in the thread code (jowenn) - if (this->thread->vmThread==0) - this->thread->vmThread=this; - startThread((thread*)(this->thread)); +#endif + if (this->thread->vmThread == 0) + this->thread->vmThread = this; + + startThread((thread *) (this->thread)); #endif } -- 2.25.1