diff options
author | Sirshak Das <sirshak.das@arm.com> | 2019-05-28 08:44:46 -0500 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-06-05 13:48:53 +0000 |
commit | 3bb6540ab531f5474217f5f1f7cb7b8dce1d4e57 (patch) | |
tree | f2fd75b2e78990a0f079d7f700a9ac5d597b72bd | |
parent | 607a23a1753ee8dc7e9150f09bb376553ed62639 (diff) |
Switch atomic test and set API from __sync to __atomic builtin
__sync_test_and_set uses full memory barriers for AArch64,
__atomic_exchange(ACQUIRE) would use load acquire.
Change-Id: Ifdf2481db3b9dde6c5842d75671402862adb6d81
Signed-off-by: Sirshak Das <sirshak.das@arm.com>
Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
-rw-r--r-- | src/vppinfra/atomics.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vppinfra/atomics.h b/src/vppinfra/atomics.h index 5444b6df350..1d480af407b 100644 --- a/src/vppinfra/atomics.h +++ b/src/vppinfra/atomics.h @@ -37,7 +37,7 @@ #define clib_atomic_cmp_and_swap(addr,old,new) __sync_val_compare_and_swap(addr, old, new) #define clib_atomic_bool_cmp_and_swap(addr,old,new) __sync_bool_compare_and_swap(addr, old, new) -#define clib_atomic_test_and_set(a) __sync_lock_test_and_set(a, 1) +#define clib_atomic_test_and_set(a) __atomic_exchange_n(a, 1, __ATOMIC_ACQUIRE) #define clib_atomic_release(a) __sync_lock_release(a) #define clib_atomic_fence_rel() __atomic_thread_fence(__ATOMIC_RELEASE); |