[atomic] Use CONSUME, not ACQUIRE, memory-order for get()
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 1 Aug 2018 02:33:37 +0000 (19:33 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 1 Aug 2018 03:28:36 +0000 (20:28 -0700)
Although, all implementations just elevate that to ACQUIRE.
But requirement for us is just CONSUME.

src/hb-atomic-private.hh

index 02cf6f3..e6a3a9a 100644 (file)
 /* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */
 
 
-#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE)
+#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME)
 
 /* C++11-style GCC primitives. */
 
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)          __atomic_fetch_add (&(AI), (V), __ATOMIC_ACQ_REL)
 
-#define hb_atomic_ptr_impl_get(P)              __atomic_load_n ((P), __ATOMIC_ACQUIRE)
+#define hb_atomic_ptr_impl_get(P)              __atomic_load_n ((P), __ATOMIC_CONSUME)
 static inline bool
 _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
 {
@@ -71,7 +71,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)          (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add ((V), std::memory_order_acq_rel))
 
-#define hb_atomic_ptr_impl_get(P)              (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_acquire))
+#define hb_atomic_ptr_impl_get(P)              (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_consume))
 static inline bool
 _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
 {