8 namespace honey {
namespace atomic {
namespace platform
25 const int32 _val = val;
27 std::atomic_thread_fence(std::memory_order_acquire);
32 std::atomic_thread_fence(std::memory_order_seq_cst);
45 std::atomic_thread_fence(std::memory_order_release);
55 static bool cas(
volatile int32& dst,
int32 newVal,
int32 cmp,
Order) {
return __sync_bool_compare_and_swap(&dst, cmp, newVal); }
61 static int64 load(
const volatile int64& val,
Order) {
return __sync_val_compare_and_swap(&val, 0, 0); }
63 static void store(
volatile int64& dst,
int64 newVal,
Order o) {
int64 v;
do { v = dst; }
while (!cas(dst, newVal, v, o)); }
64 static bool cas(
volatile int64& dst,
int64 newVal,
int64 cmp,
Order) {
return __sync_bool_compare_and_swap(&dst, cmp, newVal); }
66 static void fence(
Order o) { std::atomic_thread_fence(static_cast<std::memory_order>(o)); }
Must be a store op. Synchronize with a later acquire in another thread.
Order
Atomic memory order for concurrent synchronization between threads.
Definition: Atomic.h:23
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...
platform::SwapMaxType SwapMaxType
Largest atomically-swappable type.
Definition: Atomic.h:105
Global Honeycomb namespace.