[compiler-rt] r202852 - tsan: add another missing windows atomic operation

Dmitry Vyukov dvyukov at google.com
Tue Mar 4 06:21:43 PST 2014


Author: dvyukov
Date: Tue Mar  4 08:21:42 2014
New Revision: 202852

URL: http://llvm.org/viewvc/llvm-project?rev=202852&view=rev
Log:
tsan: add another missing windows atomic operation


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h?rev=202852&r1=202851&r2=202852&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h Tue Mar  4 08:21:42 2014
@@ -176,6 +176,19 @@ INLINE bool atomic_compare_exchange_stro
   return false;
 }
 
+INLINE bool atomic_compare_exchange_strong(volatile atomic_uint32_t *a,
+                                           u32 *cmp,
+                                           u32 xchg,
+                                           memory_order mo) {
+  u32 cmpv = *cmp;
+  u32 prev = (u32)_InterlockedCompareExchange(
+      (volatile long*)&a->val_dont_use, (long)xchg, (long)cmpv);
+  if (prev == cmpv)
+    return true;
+  *cmp = prev;
+  return false;
+}
+
 template<typename T>
 INLINE bool atomic_compare_exchange_weak(volatile T *a,
                                          typename T::Type *cmp,





More information about the llvm-commits mailing list