diff options
author | Chris Robinson <[email protected]> | 2018-11-19 03:21:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-19 03:21:58 -0800 |
commit | e24435ef58b2f28555e6397f502f41f36524dac9 (patch) | |
tree | 5b828032fff7d64a2d613a40e7dac09cc5c05840 /OpenAL32/alAuxEffectSlot.cpp | |
parent | c5142530d675885415c9168869eb6c125ce10876 (diff) |
Remove the atomic exchange macros
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.cpp')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index 9c11720e..ff0f7eaa 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -618,7 +618,7 @@ static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontex newarray->count = newcount; } - curarray = ATOMIC_EXCHANGE(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) althrd_yield(); al_free(curarray); @@ -653,7 +653,7 @@ static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcon /* TODO: Could reallocate newarray now that we know it's needed size. */ - curarray = ATOMIC_EXCHANGE(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) althrd_yield(); al_free(curarray); @@ -693,16 +693,16 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) ALeffectState *oldstate; /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed); + props = context->FreeEffectslotProps.load(std::memory_order_relaxed); if(!props) props = static_cast<ALeffectslotProps*>(al_calloc(16, sizeof(*props))); else { struct ALeffectslotProps *next; do { - next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->FreeEffectslotProps, &props, next, - almemory_order_seq_cst, almemory_order_acquire) == 0); + next = props->next.load(std::memory_order_relaxed); + } while(context->FreeEffectslotProps.compare_exchange_weak(props, next, + std::memory_order_seq_cst, std::memory_order_acquire) == 0); } /* Copy in current property values. */ @@ -719,7 +719,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) props->State = slot->Effect.State; /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(&slot->Update, props, almemory_order_acq_rel); + props = slot->Update.exchange(props, std::memory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the @@ -741,11 +741,11 @@ void UpdateAllEffectSlotProps(ALCcontext *context) ALsizei i; LockEffectSlotList(context); - auxslots = ATOMIC_LOAD(&context->ActiveAuxSlots, almemory_order_acquire); + auxslots = context->ActiveAuxSlots.load(std::memory_order_acquire); for(i = 0;i < auxslots->count;i++) { ALeffectslot *slot = auxslots->slot[i]; - if(!ATOMIC_EXCHANGE(&slot->PropsClean, AL_TRUE, almemory_order_acq_rel)) + if(!slot->PropsClean.exchange(AL_TRUE, std::memory_order_acq_rel)) UpdateEffectSlotProps(slot, context); } UnlockEffectSlotList(context); |