diff options
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 454bb715..57eee33d 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -235,6 +235,10 @@ static __inline int ExchangeInt(volatile int *ptr, int newval) { return __sync_lock_test_and_set(ptr, newval); } +static __inline void *ExchangePtr(void *volatile*ptr, void *newval) +{ + return __sync_lock_test_and_set(ptr, newval); +} static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { return __sync_bool_compare_and_swap(ptr, oldval, newval); @@ -258,6 +262,10 @@ static __inline int ExchangeInt(volatile int *ptr, int newval) } u = { ptr }; return InterlockedExchange(u.l, newval); } +static __inline void *ExchangePtr(void *volatile*ptr, void *newval) +{ + return InterlockedExchangePtr(ptr, newval); +} static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { union { @@ -286,6 +294,14 @@ static __inline int ExchangeInt(volatile int *ptr, int newval) } while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr)); return oldval; } +static __inline void *ExchangePtr(void *volatile*ptr, void *newval) +{ + void *oldval; + do { + oldval = *ptr; + } while(!OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr)); + return oldval; +} static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval) { return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr); |