Add note about __sync_bool_compare_and_swap usage (gcc/x86.h)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 26 Oct 2011 14:32:52 +0000 (18:32 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 26 Oct 2011 14:32:52 +0000 (18:32 +0400)
* src/atomic_ops/sysdeps/gcc/x86.h (AO_compare_and_swap_full): Add
comment for __sync_bool_compare_and_swap regarding variables
protection list.
* src/atomic_ops/sysdeps/gcc/x86_64.h (AO_compare_and_swap_full):
Likewise.

src/atomic_ops/sysdeps/gcc/x86.h
src/atomic_ops/sysdeps/gcc/x86_64.h

index 6709eca..b304dd0 100644 (file)
@@ -134,7 +134,11 @@ AO_INLINE int
 AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
 {
 # ifdef AO_USE_SYNC_CAS_BUILTIN
-    return (int)__sync_bool_compare_and_swap(addr, old, new_val);
+    return (int)__sync_bool_compare_and_swap(addr, old, new_val
+                                             /* empty protection list */);
+                /* Note: an empty list of variables protected by the    */
+                /* memory barrier should mean all globally accessible   */
+                /* variables are protected.                             */
 # else
     char result;
     __asm__ __volatile__("lock; cmpxchgl %3, %0; setz %1"
index 823069b..9225270 100644 (file)
@@ -131,7 +131,8 @@ AO_INLINE int
 AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
 {
 # ifdef AO_USE_SYNC_CAS_BUILTIN
-    return (int)__sync_bool_compare_and_swap(addr, old, new_val);
+    return (int)__sync_bool_compare_and_swap(addr, old, new_val
+                                             /* empty protection list */);
 # else
     char result;
     __asm__ __volatile__("lock; cmpxchgq %3, %0; setz %1"