diff options
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 796eec5b..db084e5a 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -42,7 +42,6 @@ extern inline void UnlockEffectSlotsWrite(ALCcontext *context); extern inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id); extern inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id); -static void AddEffectSlotList(ALCcontext *Context, ALeffectslot *first, ALeffectslot *last); static void RemoveEffectSlotList(ALCcontext *Context, const ALeffectslot *slot); @@ -97,12 +96,19 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo aluInitEffectPanning(slot); if(!first) first = slot; - if(last) ATOMIC_STORE(&last->next, slot); + if(last) ATOMIC_STORE(&last->next, slot, almemory_order_relaxed); last = slot; effectslots[cur] = slot->id; } - AddEffectSlotList(context, first, last); + if(last != NULL) + { + ALeffectslot *root = ATOMIC_LOAD(&context->ActiveAuxSlotList); + do { + ATOMIC_STORE(&last->next, root, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALeffectslot*, &context->ActiveAuxSlotList, + &root, first)); + } done: ALCcontext_DecRef(context); @@ -415,15 +421,6 @@ done: } -static void AddEffectSlotList(ALCcontext *context, ALeffectslot *start, ALeffectslot *last) -{ - ALeffectslot *root = ATOMIC_LOAD(&context->ActiveAuxSlotList); - do { - ATOMIC_STORE(&last->next, root, almemory_order_relaxed); - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALeffectslot*, &context->ActiveAuxSlotList, - &root, start)); -} - static void RemoveEffectSlotList(ALCcontext *context, const ALeffectslot *slot) { ALCdevice *device = context->Device; |