22#ifndef INSIDE_ATOMICS_H
23#error "should be included via atomics.h"
26#pragma intrinsic(_ReadWriteBarrier)
27#define pg_compiler_barrier_impl() _ReadWriteBarrier()
29#ifndef pg_memory_barrier_impl
30#define pg_memory_barrier_impl() MemoryBarrier()
33#define PG_HAVE_ATOMIC_U32_SUPPORT
39#define PG_HAVE_ATOMIC_U64_SUPPORT
46#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
53 current = InterlockedCompareExchange(&ptr->
value,
newval, *expected);
54 ret = current == *expected;
59#define PG_HAVE_ATOMIC_EXCHANGE_U32
66#define PG_HAVE_ATOMIC_FETCH_ADD_U32
70 return InterlockedExchangeAdd(&ptr->
value, add_);
79#pragma intrinsic(_InterlockedCompareExchange64)
81#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
88 current = _InterlockedCompareExchange64(&ptr->
value,
newval, *expected);
89 ret = current == *expected;
97#pragma intrinsic(_InterlockedExchange64)
99#define PG_HAVE_ATOMIC_EXCHANGE_U64
103 return _InterlockedExchange64(&ptr->
value,
newval);
106#pragma intrinsic(_InterlockedExchangeAdd64)
108#define PG_HAVE_ATOMIC_FETCH_ADD_U64
112 return _InterlockedExchangeAdd64(&ptr->
value, add_);
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
static bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
struct pg_attribute_aligned(8) pg_atomic_uint64
static uint32 pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval)
static uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
struct pg_atomic_uint32 pg_atomic_uint32
static bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)