Relax C++11 atomic ops memory order to acquire-release
This commit is contained in:
parent
bda242409f
commit
804b59cf49
|
@ -53,14 +53,14 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
typedef int hb_atomic_int_impl_t;
|
typedef int hb_atomic_int_impl_t;
|
||||||
#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add (V))
|
#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 ())
|
#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_acquire))
|
||||||
static inline bool
|
static inline bool
|
||||||
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
|
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
|
||||||
{
|
{
|
||||||
const void *O = O_; // Need lvalue
|
const void *O = O_; // Need lvalue
|
||||||
return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak ((O), (N));
|
return reinterpret_cast<std::atomic<const void*> *> (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)))
|
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue