diff options
author | Chris Robinson <[email protected]> | 2016-08-25 18:19:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-25 18:19:13 -0700 |
commit | ef03de39814486a1d91949cfff8b6a33bd137f91 (patch) | |
tree | 7eb149755014a3bed8b3e852534b5e7e6b8e9bd0 | |
parent | a16739f7651afb7653387b1e79b2985058d76e90 (diff) |
Avoid directly replacing the effect slot Update pointer
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index fb8c27f4..479646b1 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -636,22 +636,18 @@ void UpdateEffectSlotProps(ALeffectslot *slot) struct ALeffectslotProps *props; ALeffectState *oldstate; - props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL); + /* Get an unused property container, or allocate a new one as needed. */ + props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); if(!props) + props = al_calloc(16, sizeof(*props)); + else { - /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); - if(!props) - props = al_calloc(16, sizeof(*props)); - else - { - 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_consume) == 0); - } + 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_consume) == 0); } /* Copy in current property values. */ |