You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ma...@apache.org on 2012/02/06 10:54:35 UTC

svn commit: r1240953 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/c/tests/ThreadingUtil.cc

Author: mahadev
Date: Mon Feb  6 09:54:34 2012
New Revision: 1240953

URL: http://svn.apache.org/viewvc?rev=1240953&view=rev
Log:
ZOOKEEPER-1374. C client multi-threaded test suite fails to compile on ARM architectures. (James Page via mahadev)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/c/tests/ThreadingUtil.cc

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1240953&r1=1240952&r2=1240953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Mon Feb  6 09:54:34 2012
@@ -38,6 +38,9 @@ BUGFIXES: 
   ZOOKEEPER-1340. multi problem - typical user operations are 
   generating ERROR level messages in the server (phunt via mahadev)
 
+  ZOOKEEPER-1374. C client multi-threaded test suite fails to 
+  compile on ARM architectures. (James Page via mahadev)
+
 IMPROVEMENTS:
  
   ZOOKEEPER-1322. Cleanup/fix logging in Quorum code. (phunt via mahadev)

Modified: zookeeper/branches/branch-3.4/src/c/tests/ThreadingUtil.cc
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/tests/ThreadingUtil.cc?rev=1240953&r1=1240952&r2=1240953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/tests/ThreadingUtil.cc (original)
+++ zookeeper/branches/branch-3.4/src/c/tests/ThreadingUtil.cc Mon Feb  6 09:54:34 2012
@@ -47,6 +47,9 @@ void Mutex::release() {
 // Atomics
 int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr)
 {
+#if defined(__GNUC__)
+    return __sync_fetch_and_add(operand,incr);
+#else
     int32_t result;
     __asm__ __volatile__(
          "lock xaddl %0,%1\n"
@@ -54,15 +57,20 @@ int32_t atomic_post_incr(volatile int32_
          : "0"(incr)
          : "memory");
    return result;
+#endif
 }
 int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
 {
+#if defined(__GNUC__)
+    return __sync_lock_test_and_set(ptr,value);
+#else
     int32_t result;
     __asm__ __volatile__("lock xchgl %0,%1\n"
                           : "=r"(result), "=m"(*ptr)
                           : "0"(value)
                           : "memory");
    return result; 
+#endif
 }
 #else
 int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr){