< prev index next >

src/hotspot/share/prims/jni.cpp

Print this page

        

@@ -271,11 +271,11 @@
 
   JNIHistogramElement::JNIHistogramElement(const char* elementName) {
     _name = elementName;
     uintx count = 0;
 
-    while (Atomic::cmpxchg(1, &JNIHistogram_lock, 0) != 0) {
+    while (Atomic::cmpxchg(&JNIHistogram_lock, 0, 1) != 0) {
       while (Atomic::load_acquire(&JNIHistogram_lock) != 0) {
         count +=1;
         if ( (WarnOnStalledSpinLock > 0)
           && (count % WarnOnStalledSpinLock == 0)) {
           warning("JNIHistogram_lock seems to be stalled");

@@ -3231,11 +3231,11 @@
 static bool initializeDirectBufferSupport(JNIEnv* env, JavaThread* thread) {
   if (directBufferSupportInitializeFailed) {
     return false;
   }
 
-  if (Atomic::cmpxchg(1, &directBufferSupportInitializeStarted, 0) == 0) {
+  if (Atomic::cmpxchg(&directBufferSupportInitializeStarted, 0, 1) == 0) {
     if (!lookupDirectBufferClasses(env)) {
       directBufferSupportInitializeFailed = 1;
       return false;
     }
 
< prev index next >