aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMain.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-29 23:55:24 -0700
committerChris Robinson <[email protected]>2011-08-29 23:55:24 -0700
commitf02d9e22d755e69baab00f1d7ddceced6bac8136 (patch)
tree5c424026e216af09cddeb07f96472a2ed299ff02 /OpenAL32/Include/alMain.h
parentcc67f4589256efceb17c58673159b3e687ec0436 (diff)
Do a pointer exchange when replacing the source buffer queue
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r--OpenAL32/Include/alMain.h16
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);