diff options
| -rw-r--r-- | src/atomic_ops/sysdeps/gcc/powerpc.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/powerpc.h b/src/atomic_ops/sysdeps/gcc/powerpc.h index 94e83e7..5bee475 100644 --- a/src/atomic_ops/sysdeps/gcc/powerpc.h +++ b/src/atomic_ops/sysdeps/gcc/powerpc.h @@ -227,7 +227,8 @@ AO_test_and_set_full(volatile AO_TS_t *addr) { int result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); - AO_lwsync(); + if (result) + AO_lwsync(); return result; } # define AO_HAVE_compare_and_swap_full @@ -291,7 +292,8 @@ AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old_val, AO_t result; AO_lwsync(); result = AO_fetch_compare_and_swap(addr, old_val, new_val); - AO_lwsync(); + if (result == old_val) + AO_lwsync(); return result; } #define AO_HAVE_fetch_compare_and_swap_full |
