harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r796290 - /harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java
Date Tue, 21 Jul 2009 13:23:16 GMT
Author: hindessm
Date: Tue Jul 21 13:23:16 2009
New Revision: 796290

URL: http://svn.apache.org/viewvc?rev=796290&view=rev
Log:
Manually applied patch from "[#HARMONY-6280] [classlib][concurrent]
AtomicLong class fails with UnsatisfiedLinkError missing VMSupportsCS8".

Modified:
    harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java

Modified: harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java?rev=796290&r1=796289&r2=796290&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic/AtomicLong.java
Tue Jul 21 13:23:16 2009
@@ -32,8 +32,10 @@
      * compareAndSwap for longs. While the Unsafe.compareAndSwapLong
      * method works in either case, some constructions should be
      * handled at Java level to avoid locking user-visible locks.
+     *
+     * Initialised in the static block.
      */
-    static final boolean VM_SUPPORTS_LONG_CAS = VMSupportsCS8();
+    static final boolean VM_SUPPORTS_LONG_CAS;
 
     /**
      * Returns whether underlying JVM supports lockless CompareAndSet
@@ -46,6 +48,15 @@
         valueOffset = unsafe.objectFieldOffset
             (AtomicLong.class.getDeclaredField("value"));
       } catch (Exception ex) { throw new Error(ex); }
+      
+      boolean longCASSupport;
+      try {
+         longCASSupport = VMSupportsCS8();
+      } catch (UnsatisfiedLinkError e) {
+         // assume there's support if the native isn't provided by the VM
+         longCASSupport = true;
+      }
+      VM_SUPPORTS_LONG_CAS = longCASSupport;
     }
 
     private volatile long value;



Mime
View raw message