提交 ad275627 编写于 作者: B Behdad Esfahbod

[atomic] On IBM, use light-weight sync for everything

lwsync() is a full read/write-barrier.  That's all we need, never
need sync().  I'm not sure why an isync() was used in fetch_and_add,
but since that's a read-modify-write, I just changed it to have
lwsync() on both sides.
上级 fd638d21
......@@ -163,20 +163,20 @@ static inline void _hb_memory_barrier (void) { OSMemoryBarrier (); }
static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
__lwsync();
int result = __fetch_and_add(AI, V);
__isync();
__lwsync();
return result;
}
static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
__sync();
__lwsync();
int result = __compare_and_swaplp (P, &O, N);
__sync();
__lwsync();
return result;
}
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
static inline void _hb_memory_barrier (void) { __sync(); }
static inline void _hb_memory_barrier (void) { __lwsync(); }
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册