8 namespace honey {
namespace atomic {
namespace platform
23 const int32 _val = val;
25 std::atomic_thread_fence(std::memory_order_acquire);
30 std::atomic_thread_fence(std::memory_order_seq_cst);
43 std::atomic_thread_fence(std::memory_order_release);
53 static bool cas(
volatile int32& dst,
int32 newVal,
int32 cmp,
Order) {
return __sync_bool_compare_and_swap(&dst, cmp, newVal); }
59 static int64 load(
const volatile int64& val,
Order) {
return __sync_val_compare_and_swap(&val, 0, 0); }
61 static void store(
volatile int64& dst,
int64 newVal,
Order o) {
int64 v;
do { v = dst; }
while (!cas(dst, newVal, v, o)); }
62 static bool cas(
volatile int64& dst,
int64 newVal,
int64 cmp,
Order) {
return __sync_bool_compare_and_swap(&dst, cmp, newVal); }
64 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...
Global Honeycomb namespace.