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:53:15 UTC

svn commit: r1240952 - in /zookeeper/trunk: CHANGES.txt src/c/tests/ThreadingUtil.cc

Author: mahadev
Date: Mon Feb  6 09:53:15 2012
New Revision: 1240952

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

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/c/tests/ThreadingUtil.cc

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1240952&r1=1240951&r2=1240952&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Mon Feb  6 09:53:15 2012
@@ -124,6 +124,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:
 

Modified: zookeeper/trunk/src/c/tests/ThreadingUtil.cc
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/tests/ThreadingUtil.cc?rev=1240952&r1=1240951&r2=1240952&view=diff
==============================================================================
--- zookeeper/trunk/src/c/tests/ThreadingUtil.cc (original)
+++ zookeeper/trunk/src/c/tests/ThreadingUtil.cc Mon Feb  6 09:53:15 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){