diff options
author | Chris Robinson <[email protected]> | 2018-03-26 10:14:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-03-26 10:14:27 -0700 |
commit | 788f5398b019a9c21e9c82906431c3d8261842cf (patch) | |
tree | b57fb8caa57fe0b7143d63ccfadbff44542035ce | |
parent | 964723691ac45943b6d9b62268ec7908cf27b6a6 (diff) |
Slightly relax the memory order for ref counters
-rw-r--r-- | common/atomic.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/atomic.h b/common/atomic.h index 64b06cce..39daa1dc 100644 --- a/common/atomic.h +++ b/common/atomic.h @@ -413,11 +413,11 @@ typedef ATOMIC(uint) RefCount; inline void InitRef(RefCount *ptr, uint value) { ATOMIC_INIT(ptr, value); } inline uint ReadRef(RefCount *ptr) -{ return ATOMIC_LOAD_SEQ(ptr); } +{ return ATOMIC_LOAD(ptr, almemory_order_acquire); } inline uint IncrementRef(RefCount *ptr) -{ return ATOMIC_ADD_SEQ(ptr, 1)+1; } +{ return ATOMIC_ADD(ptr, 1, almemory_order_acq_rel)+1; } inline uint DecrementRef(RefCount *ptr) -{ return ATOMIC_SUB_SEQ(ptr, 1)-1; } +{ return ATOMIC_SUB(ptr, 1, almemory_order_acq_rel)-1; } /* WARNING: A livelock is theoretically possible if another thread keeps |