harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r597134 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
Date Wed, 21 Nov 2007 16:21:18 GMT
Author: gshimansky
Date: Wed Nov 21 08:21:17 2007
New Revision: 597134

URL: http://svn.apache.org/viewvc?rev=597134&view=rev
Log:
Applied patch from HARMONY-5136
[drlvm] DRL VM hangs during stress.Mix running.


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp?rev=597134&r1=597133&r2=597134&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp Wed Nov 21 08:21:17 2007
@@ -151,14 +151,24 @@
     }
     hythread_iterator_release(&it);
 
-    TRACE2("shutdown", "joining threads");
-    // join running threads
-    // blocked and waiting threads won't be joined
+    TRACE2("shutdown", "waiting threads");
     for (int i = 0; i < size; i++) {
-        hythread_join_timed(running_threads[i], 100/size + 1, 0);
+        hythread_sleep(100);
     }
 
     TRACE2("shutdown", "cancelling threads");
+
+    JNIEnv *jni_env = jthread_self_vm_thread()->jni_env;
+    Class* klass = vm_env->java_lang_ThreadGroup_Class;
+    jobject class_handle = struct_Class_to_jclass(klass);
+    jfieldID lock_field_id = jni_env->GetStaticFieldID(class_handle, "lock",
+        "Ljava/lang/ThreadGroup$ThreadGroupLock;");
+    assert(lock_field_id);
+    jobject lock_field = jni_env->GetStaticObjectField(class_handle, lock_field_id);
+    assert(lock_field);
+    IDATA status = jthread_monitor_enter(lock_field);
+    assert(status == TM_ERROR_NONE);
+
     // forcedly kill remaining threads
     // There is a small chance that some of these threads are not in the point
     // safe for killing, e.g. in malloc()
@@ -174,6 +184,9 @@
         }
     }
     hythread_iterator_release(&it);
+
+    status = jthread_monitor_exit(lock_field);
+    assert(status == TM_ERROR_NONE);
 
     TRACE2("shutdown", "shutting down threads complete");
 }



Mime
View raw message