harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r601425 - in /harmony/enhanced/drlvm/trunk/vm: thread/src/thread_native_basic.c vmcore/include/thread_manager.h vmcore/src/thread/thread_java_basic.cpp
Date Wed, 05 Dec 2007 17:21:52 GMT
Author: gshimansky
Date: Wed Dec  5 09:21:52 2007
New Revision: 601425

URL: http://svn.apache.org/viewvc?rev=601425&view=rev
Log:
Applied patch from HARMONY-5235
[drlvm][thread] Thread arguments are prepared/processed incorrectly


Modified:
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/thread_manager.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c?rev=601425&r1=601424&r2=601425&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c Wed Dec  5 09:21:52 2007
@@ -79,7 +79,6 @@
 {
     int result;
     hythread_t self;
-    hythread_start_proc_data_t start_proc_data;
 
     assert(new_thread);
     hythread_struct_init(new_thread);
@@ -89,26 +88,25 @@
     new_thread->priority = priority ? priority : HYTHREAD_PRIORITY_NORMAL;
     new_thread->stacksize = stacksize ? stacksize : TM_DEFAULT_STACKSIZE;
     
-    if (wrapper) {
-        assert(data);
-        start_proc_data = (hythread_start_proc_data_t)data;
-    } else {
+    if (!wrapper) {
+        hythread_start_proc_data_t start_proc_data;
+
         // No need to zero allocated memory because all fields are initilized below.
         start_proc_data =
             (hythread_start_proc_data_t) malloc(sizeof(hythread_start_proc_data));
         if (start_proc_data == NULL) {
             return TM_ERROR_OUT_OF_MEMORY;
         }
-    }
 
-    // Set up thread body procedure 
-    start_proc_data->thread = new_thread;
-    start_proc_data->group = group == NULL ? TM_DEFAULT_GROUP : group;
-    start_proc_data->proc = func;
-    start_proc_data->proc_args = data;
+        // Set up thread body procedure 
+        start_proc_data->thread = new_thread;
+        start_proc_data->group = group == NULL ? TM_DEFAULT_GROUP : group;
+        start_proc_data->proc = func;
+        start_proc_data->proc_args = data;
 
-    // Set wrapper procedure
-    if (!wrapper) {
+        data = (void*)start_proc_data;
+
+        // Set wrapper procedure
         wrapper = hythread_wrapper_start_proc;
     }
 
@@ -116,7 +114,7 @@
     // until os_thread_create returned and initialized thread->os_handle properly.
     hythread_global_lock();
     result = os_thread_create(&new_thread->os_handle, new_thread->stacksize,
-            priority, wrapper, (void *)start_proc_data);
+            priority, wrapper, data);
     assert(/* error */ result || new_thread->os_handle /* or thread created ok */);
     hythread_global_unlock();
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/thread_manager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/thread_manager.h?rev=601425&r1=601424&r2=601425&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/thread_manager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/thread_manager.h Wed Dec  5 09:21:52 2007
@@ -241,9 +241,9 @@
 struct jthread_start_proc_data
 {
     /**
-     * HyThread library procedure data
+     * Native thread
      */
-    hythread_start_proc_data hy_data;
+    hythread_t native_thread;
 
     /**
      * Pointer to Java VM.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp?rev=601425&r1=601424&r2=601425&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp Wed Dec  5 09:21:52
2007
@@ -67,7 +67,7 @@
     assert(status == TM_ERROR_NONE);
 
     // get native thread
-    hythread_t native_thread = start_proc_data.hy_data.thread;
+    hythread_t native_thread = start_proc_data.native_thread;
 
     // check hythread library state
     if (hythread_lib_state() != TM_LIBRARY_STATUS_INITIALIZED) {
@@ -99,7 +99,7 @@
     }
 
     // register to group and set ALIVE & RUNNABLE states
-    status = hythread_set_to_group(native_thread, start_proc_data.hy_data.group);
+    status = hythread_set_to_group(native_thread, get_java_thread_group());
     assert(status == TM_ERROR_NONE);
 
     // set hythread_self()
@@ -237,6 +237,7 @@
         return TM_ERROR_OUT_OF_MEMORY;
     }
     *attrs = *given_attrs;
+    attrs->native_thread = native_thread;
 
     // Get JavaVM 
     IDATA status = jni_env->GetJavaVM(&attrs->java_vm);



Mime
View raw message