From 804b59cf4901d471253016e0cbf82cc1bbbc1d15 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 16 Jul 2018 15:44:58 +0200 Subject: [PATCH] Relax C++11 atomic ops memory order to acquire-release --- src/hb-atomic-private.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index f234fe04..14960026 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -53,14 +53,14 @@ #include typedef int hb_atomic_int_impl_t; -#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add (V)) +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add (V, std::memory_order_acq_rel)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load ()) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { const void *O = O_; // Need lvalue - return reinterpret_cast *> (P)->compare_exchange_weak ((O), (N)); + return reinterpret_cast *> (P)->compare_exchange_weak ((O), (N), std::memory_order_acq_rel); } #define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))) -- GitLab