aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-11 18:40:17 -0700
committerChris Robinson <[email protected]>2016-05-11 21:02:11 -0700
commit186b54aa3d5f1398a384fa318aa000210d82437e (patch)
tree32daef17365aee1fb61a05db9b6c23aec25f6e07 /OpenAL32/alAuxEffectSlot.c
parent21bc0f5ef8f0e410ea840061589b844d6e401afc (diff)
Use a lockless method for updating listener and context properties
This uses a separate container to provide the relevant properties to the internal update method, using atomic pointer swaps. A free-list is used to avoid having too many individual containers. This allows the mixer to update the internal listener properties without requiring the lock to protect against async updates. It also allows concurrent read access to the user-facing property values, even the multi-value ones (e.g. the vectors).
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 9780cff3..7f570ef8 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -29,6 +29,7 @@
#include "alAuxEffectSlot.h"
#include "alThunk.h"
#include "alError.h"
+#include "alListener.h"
#include "alSource.h"
#include "almalloc.h"
@@ -187,7 +188,6 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
err = InitializeEffect(device, slot, effect);
if(err != AL_NO_ERROR)
SET_ERROR_AND_GOTO(context, err, done);
- ATOMIC_STORE(&context->UpdateSources, AL_TRUE);
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
@@ -195,12 +195,15 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
slot->AuxSendAuto = value;
- ATOMIC_STORE(&context->UpdateSources, AL_TRUE);
break;
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
+ /* HACK: Force sources to update by doing a listener update */
+ ReadLock(&context->PropLock);
+ UpdateListenerProps(context);
+ ReadUnlock(&context->PropLock);
done:
ALCcontext_DecRef(context);