aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-14 17:47:55 -0700
committerChris Robinson <[email protected]>2017-04-14 17:47:55 -0700
commitf94fa5d5cfb78ab5438a53b2ad17f033660103c9 (patch)
tree51e9f2b06bb77389fb6237917a2f7462402c8cab /OpenAL32
parent9e60eea93b029f1c2d2e394e2352b86cd7c65d12 (diff)
Use separate atomic macros for pointers
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alAuxEffectSlot.c18
-rw-r--r--OpenAL32/alError.c4
-rw-r--r--OpenAL32/alListener.c7
-rw-r--r--OpenAL32/alSource.c19
4 files changed, 21 insertions, 27 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 743fac14..de7de943 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -126,9 +126,8 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
if(curarray)
memcpy(newarray->slot+n, curarray->slot, sizeof(ALeffectslot*)*curarray->count);
- newarray = ATOMIC_EXCHANGE(struct ALeffectslotArray*,
- &context->ActiveAuxSlots, newarray, almemory_order_acq_rel
- );
+ newarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray,
+ almemory_order_acq_rel);
device = context->Device;
while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1))
althrd_yield();
@@ -187,9 +186,8 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *
newarray->slot[i++] = slot;
}
- newarray = ATOMIC_EXCHANGE(struct ALeffectslotArray*,
- &context->ActiveAuxSlots, newarray, almemory_order_acq_rel
- );
+ newarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray,
+ almemory_order_acq_rel);
device = context->Device;
while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1))
althrd_yield();
@@ -668,9 +666,8 @@ void UpdateEffectSlotProps(ALeffectslot *slot)
struct ALeffectslotProps *next;
do {
next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*,
- &slot->FreeList, &props, next, almemory_order_seq_cst,
- almemory_order_acquire) == 0);
+ } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&slot->FreeList, &props, next,
+ almemory_order_seq_cst, almemory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -687,8 +684,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot)
props->State = slot->Effect.State;
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, props,
- almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&slot->Update, props, almemory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c
index 19fcaa6d..6c953977 100644
--- a/OpenAL32/alError.c
+++ b/OpenAL32/alError.c
@@ -49,7 +49,7 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
#endif
}
- ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALenum, &Context->LastError, &curerr, errorCode);
+ (void)(ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&Context->LastError, &curerr, errorCode));
}
AL_API ALenum AL_APIENTRY alGetError(void)
@@ -74,7 +74,7 @@ AL_API ALenum AL_APIENTRY alGetError(void)
return AL_INVALID_OPERATION;
}
- errorCode = ATOMIC_EXCHANGE_SEQ(ALenum, &Context->LastError, AL_NO_ERROR);
+ errorCode = ATOMIC_EXCHANGE_SEQ(&Context->LastError, AL_NO_ERROR);
ALCcontext_DecRef(Context);
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index e3d71435..d117c0ca 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -468,9 +468,8 @@ void UpdateListenerProps(ALCcontext *context)
struct ALlistenerProps *next;
do {
next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*,
- &listener->FreeList, &props, next, almemory_order_seq_cst,
- almemory_order_acquire) == 0);
+ } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&listener->FreeList, &props, next,
+ almemory_order_seq_cst, almemory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -500,7 +499,7 @@ void UpdateListenerProps(ALCcontext *context)
props->DistanceModel = context->DistanceModel;;
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &listener->Update, props, almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&listener->Update, props, almemory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index a8c4ce2f..040078df 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -158,7 +158,7 @@ static inline ALenum GetSourceState(ALsource *source, ALvoice *voice)
if(!voice)
{
ALenum state = AL_PLAYING;
- if(ATOMIC_COMPARE_EXCHANGE_STRONG(ALenum, &source->state, &state, AL_STOPPED,
+ if(ATOMIC_COMPARE_EXCHANGE_STRONG(&source->state, &state, AL_STOPPED,
almemory_order_acq_rel, almemory_order_acquire))
return AL_STOPPED;
return state;
@@ -747,7 +747,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
Source->SourceType = AL_UNDETERMINED;
newlist = NULL;
}
- oldlist = ATOMIC_EXCHANGE_SEQ(ALbufferlistitem*, &Source->queue, newlist);
+ oldlist = ATOMIC_EXCHANGE_PTR_SEQ(&Source->queue, newlist);
WriteUnlock(&Source->queue_lock);
UnlockBuffersRead(device);
@@ -2784,8 +2784,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
source->SourceType = AL_STREAMING;
BufferList = NULL;
- if(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALbufferlistitem*, &source->queue,
- &BufferList, BufferListStart))
+ if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&source->queue, &BufferList,
+ BufferListStart))
{
/* Queue head is not NULL, append to the end of the queue */
while(BufferList->next != NULL)
@@ -2854,7 +2854,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint
}
/* Swap it, and cut the new head from the old. */
- OldHead = ATOMIC_EXCHANGE_SEQ(ALbufferlistitem*, &source->queue, OldTail->next);
+ OldHead = ATOMIC_EXCHANGE_PTR_SEQ(&source->queue, OldTail->next);
if(OldTail->next)
{
ALCdevice *device = context->Device;
@@ -3003,7 +3003,7 @@ static void DeinitSource(ALsource *source, ALsizei num_sends)
if(count > 3)
WARN("Freed "SZFMT" Source property objects\n", count);
- BufferList = ATOMIC_EXCHANGE_SEQ(ALbufferlistitem*, &source->queue, NULL);
+ BufferList = ATOMIC_EXCHANGE_PTR_SEQ(&source->queue, NULL);
while(BufferList != NULL)
{
ALbufferlistitem *next = BufferList->next;
@@ -3040,9 +3040,8 @@ static void UpdateSourceProps(ALsource *source, ALsizei num_sends)
struct ALsourceProps *next;
do {
next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*,
- &source->FreeList, &props, next, almemory_order_acq_rel,
- almemory_order_acquire) == 0);
+ } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&source->FreeList, &props, next,
+ almemory_order_acq_rel, almemory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -3103,7 +3102,7 @@ static void UpdateSourceProps(ALsource *source, ALsizei num_sends)
}
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, props, almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&source->Update, props, almemory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the