8 namespace honey {
namespace atomic {
namespace platform
26 static int32 load(
volatile const int32& val, Order::t o)
35 const int32 _val = val;
47 static void store(
volatile int32& dst,
int32 newVal, Order::t o)
65 static bool cas(
volatile int32& dst,
int32 newVal,
int32 cmp, Order::t) {
return InterlockedCompareExchange(reinterpret_cast<volatile LONG*>(&dst), newVal, cmp) == cmp; }
67 static int32 swap(
volatile int32& dst,
int32 newVal, Order::t =
Order::seqCst) {
return InterlockedExchange(reinterpret_cast<volatile LONG*>(&dst), newVal); }
68 static int32 inc(
volatile int32& val, Order::t =
Order::seqCst) {
return InterlockedIncrement(reinterpret_cast<volatile LONG*>(&val))-1; }
69 static int32 dec(
volatile int32& val, Order::t =
Order::seqCst) {
return InterlockedDecrement(reinterpret_cast<volatile LONG*>(&val))+1; }
72 static int64 load(
const volatile int64& val, Order::t) {
return _InterlockedCompareExchange64(const_cast<volatile LONGLONG*>(&val), 0, 0); }
74 static void store(
volatile int64& dst,
int64 newVal, Order::t o) {
int64 v;
do { v = dst; }
while (!cas(dst, newVal, v, o)); }
75 static bool cas(
volatile int64& dst,
int64 newVal,
int64 cmp, Order::t) {
return _InterlockedCompareExchange64(static_cast<volatile LONGLONG*>(&dst), newVal, cmp) == cmp; }
77 static void fence(Order::t o)
Must be a store op. Synchronize with a later acquire in another thread.
ostream & dec(ostream &os)
Use decimal encoding (big-endian integer) when writing bytes to a string stream.
Definition: Encode.h:66
Must be a load op. Synchronize with a prior release in another thread.
No order constraint, same as plain load/store. Unsafe but best performance.
int int32
Definition: Core.h:15
Op
Definition: Unique.h:16
long long int64
Definition: Core.h:21
Sequential consistency, safe total order but least performance.
Must be a load op. Synchronize with a prior release in another thread, but only synchronize ops depen...
Must be a load-modify-store op. Performs both acquire and release.
Global Honeycomb namespace.