InterlockedAdd -> InterlockedExchangeAdd for better portability (InterlockedAdd is not always supported)
This commit is contained in:
@@ -365,7 +365,7 @@ lAtomicCompareAndSwap32(volatile int32_t *v, int32_t newValue, int32_t oldValue)
|
|||||||
static inline int32_t
|
static inline int32_t
|
||||||
lAtomicAdd(volatile int32_t *v, int32_t delta) {
|
lAtomicAdd(volatile int32_t *v, int32_t delta) {
|
||||||
#ifdef ISPC_IS_WINDOWS
|
#ifdef ISPC_IS_WINDOWS
|
||||||
return InterlockedAdd((volatile LONG *)v, delta);
|
return InterlockedExchangeAdd((volatile LONG *)v, delta)+delta;
|
||||||
#else
|
#else
|
||||||
return __sync_fetch_and_add(v, delta);
|
return __sync_fetch_and_add(v, delta);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user