From e4b779c492e9ffbfce806ac49acae66ab264a7da Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 22 Jul 2014 18:57:51 -0700 Subject: Use generic atomics in more places --- OpenAL32/Include/alAuxEffectSlot.h | 2 +- OpenAL32/Include/alMain.h | 4 ++-- OpenAL32/alAuxEffectSlot.c | 8 ++++---- OpenAL32/alError.c | 4 ++-- OpenAL32/alState.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index bc871111..286aa95d 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -71,7 +71,7 @@ typedef struct ALeffectslot { volatile ALfloat Gain; volatile ALboolean AuxSendAuto; - volatile ALenum NeedsUpdate; + ATOMIC(ALenum) NeedsUpdate; ALeffectState *EffectState; alignas(16) ALfloat WetBuffer[1][BUFFERSIZE]; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a444610f..623968d0 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -621,7 +621,7 @@ struct ALCdevice_struct al_string DeviceName; - volatile ALCenum LastError; + ATOMIC(ALCenum) LastError; // Maximum number of sources that can be created ALuint MaxNoOfSources; @@ -746,7 +746,7 @@ struct ALCcontext_struct UIntMap SourceMap; UIntMap EffectSlotMap; - volatile ALenum LastError; + ATOMIC(ALenum) LastError; ATOMIC(ALenum) UpdateSources; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 0eb79aec..a2060f0a 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -246,7 +246,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); slot->Gain = value; - slot->NeedsUpdate = AL_TRUE; + ATOMIC_STORE(slot->NeedsUpdate, AL_TRUE); break; default: @@ -485,7 +485,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e /* FIXME: This should be done asynchronously, but since the EffectState * object was changed, it needs an update before its Process method can * be called. */ - EffectSlot->NeedsUpdate = AL_FALSE; + ATOMIC_STORE(EffectSlot->NeedsUpdate, AL_FALSE); V(EffectSlot->EffectState,update)(Device, EffectSlot); ALCdevice_Unlock(Device); @@ -501,7 +501,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e ALCdevice_Lock(Device); memcpy(&EffectSlot->EffectProps, &effect->Props, sizeof(effect->Props)); ALCdevice_Unlock(Device); - EffectSlot->NeedsUpdate = AL_TRUE; + ATOMIC_STORE(EffectSlot->NeedsUpdate, AL_TRUE); } } @@ -522,7 +522,7 @@ ALenum InitEffectSlot(ALeffectslot *slot) slot->Gain = 1.0; slot->AuxSendAuto = AL_TRUE; - slot->NeedsUpdate = AL_FALSE; + ATOMIC_STORE_UNSAFE(slot->NeedsUpdate, AL_FALSE); for(c = 0;c < 1;c++) { for(i = 0;i < BUFFERSIZE;i++) diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c index b557532e..04700d97 100644 --- a/OpenAL32/alError.c +++ b/OpenAL32/alError.c @@ -45,7 +45,7 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode) raise(SIGTRAP); #endif } - CompExchangeInt(&Context->LastError, AL_NO_ERROR, errorCode); + ATOMIC_COMPARE_EXCHANGE(ALenum, Context->LastError, AL_NO_ERROR, errorCode); } AL_API ALenum AL_APIENTRY alGetError(void) @@ -68,7 +68,7 @@ AL_API ALenum AL_APIENTRY alGetError(void) return AL_INVALID_OPERATION; } - errorCode = ExchangeInt(&Context->LastError, AL_NO_ERROR); + errorCode = ATOMIC_EXCHANGE(ALenum, Context->LastError, AL_NO_ERROR); ALCcontext_DecRef(Context); diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 59619b0d..6e6ca544 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -752,7 +752,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) slot_end = VECTOR_ITER_END(context->ActiveAuxSlots); while(slot != slot_end) { - if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) + if(ATOMIC_EXCHANGE(ALenum, (*slot)->NeedsUpdate, AL_FALSE)) V((*slot)->EffectState,update)(context->Device, *slot); slot++; } -- cgit v1.2.3