harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r666018 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
Date Tue, 10 Jun 2008 08:56:58 GMT
Author: varlax
Date: Tue Jun 10 01:56:57 2008
New Revision: 666018

URL: http://svn.apache.org/viewvc?rev=666018&view=rev
Log:
Avoid data race at static initializers

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

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?rev=666018&r1=666017&r2=666018&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Tue Jun 10 01:56:57 2008
@@ -1448,12 +1448,14 @@
 
     if (clss == vm_env->java_lang_reflect_Constructor_Class) 
     {
-        static jmethodID m = (jmethodID)class_lookup_method(clss, "getId", "()J");
+        static jmethodID m; 
+        if (!m) m = (jmethodID)class_lookup_method(clss, "getId", "()J");
         return (jmethodID) ((POINTER_SIZE_INT) CallLongMethodA(jni_env, method, m, 0));
     } 
     else if (clss == vm_env->java_lang_reflect_Method_Class)
     {
-        static jmethodID m = (jmethodID)class_lookup_method(clss, "getId", "()J");
+        static jmethodID m;
+        if (!m) m = (jmethodID)class_lookup_method(clss, "getId", "()J");
         return (jmethodID) ((POINTER_SIZE_INT) CallLongMethodA(jni_env, method, m, 0));
     }
     return NULL;
@@ -1468,7 +1470,8 @@
 
     if (clss == vm_env->java_lang_reflect_Field_Class) 
     {
-        static jmethodID m = (jmethodID)class_lookup_method(clss, "getId", "()J");
+        static jmethodID m;
+        if (!m) m = (jmethodID)class_lookup_method(clss, "getId", "()J");
         return (jfieldID) ((POINTER_SIZE_INT) CallLongMethodA(jni_env, field, m, 0));
     }
     return NULL;



Mime
View raw message