* src/threads/threads-common.c (stdint.h): Added.
authortwisti <none@none>
Wed, 8 Aug 2007 14:55:00 +0000 (14:55 +0000)
committertwisti <none@none>
Wed, 8 Aug 2007 14:55:00 +0000 (14:55 +0000)
(threads_thread_free): Also save and restore the thread state (this is
required for CLDC1.1, but is generally a good idea).

* src/native/vm/java_lang_Thread.c (isAlive) [WITH_CLASSPATH_CLDC1_1]:
Check for NULL.

src/native/vm/java_lang_Thread.c
src/threads/threads-common.c

index 421c1823e3dee10dcf397c696c20a70ecaa536d9..5b5f266488aa315f487ad2fe63c49e74b17ad49f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_Thread.c 8132 2007-06-22 11:15:47Z twisti $
+   $Id: java_lang_Thread.c 8272 2007-08-08 14:55:00Z twisti $
 
 */
 
@@ -129,8 +129,11 @@ s4 _Jv_java_lang_Thread_isAlive(java_lang_Thread *this)
        threadobject *t;
 
 # if defined(WITH_CLASSPATH_GNU)
+
        t = (threadobject *) this->vmThread->vmdata;
+
 # elif defined(WITH_CLASSPATH_SUN)
+
        /* XXX this is just a quick hack */
 
        for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
@@ -143,8 +146,14 @@ s4 _Jv_java_lang_Thread_isAlive(java_lang_Thread *this)
 
        if (t == NULL)
                return 0;
+
 # elif defined(WITH_CLASSPATH_CLDC1_1)
+
        t = (threadobject *) this->vm_thread;
+
+       if (t == NULL)
+               return 0;
+
 # else
 #  error unknown classpath configuration
 # endif
index 8efa34cf5a37b99e4d5a3a0d860670893bab7d7b..ffd36096470101cde069bd91e27b0cd12d1b79da 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads-common.c 8266 2007-08-07 08:26:38Z twisti $
+   $Id: threads-common.c 8272 2007-08-08 14:55:00Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <unistd.h>
 
 #include "vm/types.h"
@@ -316,7 +317,8 @@ threadobject *threads_thread_new(void)
 
 void threads_thread_free(threadobject *t)
 {
-       s4 index;
+       int32_t  index;
+       uint32_t state;
 
        /* lock the threads-lists */
 
@@ -330,15 +332,19 @@ void threads_thread_free(threadobject *t)
 
        list_remove_unsynced(list_threads, t);
 
-       /* Clear memory, but keep the thread-index. */
+       /* Clear memory, but keep the thread-index and the
+          thread-state. */
+
        /* ATTENTION: Do this after list_remove, otherwise the linkage
           pointers are invalid. */
 
        index = t->index;
+       state = t->state;
 
        MZERO(t, threadobject, 1);
 
        t->index = index;
+       t->state = state;
 
        /* add the thread to the free list */