harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r575724 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src: kernel_classes/javasrc/java/lang/Thread.java thread/thread_java_basic.cpp
Date Fri, 14 Sep 2007 15:38:11 GMT
Author: gshimansky
Date: Fri Sep 14 08:38:11 2007
New Revision: 575724

URL: http://svn.apache.org/viewvc?rev=575724&view=rev
Log:
Applied patch from HARMONY-4389
[drlvm][jvmti] Thread.isAlive() is false in THREAD_STRAT event callback


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?rev=575724&r1=575723&r2=575724&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Fri Sep 14 08:38:11 2007
@@ -294,6 +294,7 @@
         
         long oldPointer = (oldRef == null) ? 0 : oldRef.getNativeAddr();
         long newPointer = VMThreadManager.init(this, newRef, oldPointer);
+
         if (newPointer == 0) {
             throw new OutOfMemoryError("Failed to create new thread");
         }
@@ -669,6 +670,13 @@
     public void run() {
         if (target != null) {
             target.run();
+        }
+    }
+
+    void setAlive(boolean alive) {
+        synchronized (lock) {
+            this.isAlive = true;
+            lock.notifyAll();
         }
     }
 

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=575724&r1=575723&r2=575724&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 Fri Sep 14 08:38:11
2007
@@ -30,6 +30,7 @@
 #include "cxxlog.h"
 
 static jmethodID jthread_get_run_method(JNIEnv * env, jthread java_thread);
+static jmethodID jthread_get_set_alive_method(JNIEnv * env, jthread java_thread);
 static IDATA jthread_associate_native_and_java_thread(JNIEnv * env,
     jthread java_thread, hythread_t native_thread, jobject weak_ref);
 
@@ -80,6 +81,9 @@
     }
 
     // Send Thread Start event.
+    assert(hythread_is_alive(native_thread));
+    jni_env->CallVoidMethod(java_thread,
+        jthread_get_set_alive_method(jni_env, java_thread), true);
     jvmti_send_thread_start_end_event(1);
     jthread_start_count();
 
@@ -199,6 +203,7 @@
     }
 
     // Send Thread Start event.
+    assert(hythread_is_alive(native_thread));
     jvmti_send_thread_start_end_event(1);
     jthread_start_count();
 
@@ -593,5 +598,18 @@
     }
     TRACE("run method find exit");
     return run_method;
+} // jthread_get_run_method
+
+static jmethodID jthread_get_set_alive_method(JNIEnv * env, jthread java_thread)
+{
+    static jmethodID set_alive_method = NULL;
+
+    TRACE("run method find enter");
+    if (!set_alive_method) {
+        jclass clazz = env->GetObjectClass(java_thread);
+        set_alive_method = env->GetMethodID(clazz, "setAlive", "(Z)V");
+    }
+    TRACE("run method find exit");
+    return set_alive_method;
 } // jthread_get_run_method
 



Mime
View raw message