diff options
author | Chris Robinson <[email protected]> | 2018-11-18 03:59:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-18 03:59:39 -0800 |
commit | f48be9d73b4472570d28bf381d84e40cf65694c8 (patch) | |
tree | 59a4b4a9c869beab928cf06a35d3592dc4c334d0 /Alc | |
parent | 7433cb5f4cb0515dd6e314978f579ae91e2c63c4 (diff) |
Remove the pointer-specific atomic exchange macros
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alc.cpp | 22 | ||||
-rw-r--r-- | Alc/alu.cpp | 24 |
2 files changed, 22 insertions, 24 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index ec836bfa..bf665cfe 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2331,8 +2331,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) * auxiliary sends is changing. Active sources will have updates * respecified in UpdateAllSourceProps. */ - vprops = static_cast<ALvoiceProps*>(ATOMIC_EXCHANGE_PTR(&context->FreeVoiceProps, - static_cast<ALvoiceProps*>(nullptr), almemory_order_acq_rel)); + vprops = ATOMIC_EXCHANGE(&context->FreeVoiceProps, static_cast<ALvoiceProps*>(nullptr), + almemory_order_acq_rel); while(vprops) { struct ALvoiceProps *next = ATOMIC_LOAD(&vprops->next, almemory_order_relaxed); @@ -2345,8 +2345,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { ALvoice *voice = context->Voices[pos]; - al_free(ATOMIC_EXCHANGE_PTR(&voice->Update, static_cast<ALvoiceProps*>(nullptr), - almemory_order_acq_rel)); + al_free(ATOMIC_EXCHANGE(&voice->Update, static_cast<ALvoiceProps*>(nullptr), + almemory_order_acq_rel)); if(ATOMIC_LOAD(&voice->Source, almemory_order_acquire) == nullptr) continue; @@ -2711,7 +2711,7 @@ static void FreeContext(ALCcontext *context) context->DefaultSlot = nullptr; } - al_free(ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, + al_free(ATOMIC_EXCHANGE(&context->ActiveAuxSlots, static_cast<ALeffectslotArray*>(nullptr), almemory_order_relaxed)); ReleaseALSources(context); @@ -2813,7 +2813,7 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device) V0(device->Backend,lock)(); origctx = context; newhead = ATOMIC_LOAD(&context->next, almemory_order_relaxed); - if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&device->ContextList, &origctx, newhead)) + if(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&device->ContextList, &origctx, newhead)) { ALCcontext *list; do { @@ -2822,7 +2822,7 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device) */ list = origctx; origctx = context; - } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origctx, newhead)); + } while(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&list->next, &origctx, newhead)); } else ret = !!newhead; @@ -3848,8 +3848,8 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ALCcontext *head = ATOMIC_LOAD_SEQ(&device->ContextList); do { ATOMIC_STORE(&ALContext->next, head, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&device->ContextList, &head, - ALContext) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(&device->ContextList, &head, + ALContext) == 0); } almtx_unlock(&device->BackendLock); @@ -4204,7 +4204,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) do { list = origdev; origdev = device; - } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); + } while(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&list->next, &origdev, nextdev)); } listlock.unlock(); @@ -4332,7 +4332,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) do { list = origdev; origdev = device; - } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); + } while(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&list->next, &origdev, nextdev)); } listlock.unlock(); diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 92aa2bc4..9a02d4b6 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -75,7 +75,7 @@ static HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_C; void DeinitVoice(ALvoice *voice) { - al_free(ATOMIC_EXCHANGE_PTR_SEQ(&voice->Update, static_cast<ALvoiceProps*>(nullptr))); + al_free(ATOMIC_EXCHANGE_SEQ(&voice->Update, static_cast<ALvoiceProps*>(nullptr))); } @@ -315,8 +315,8 @@ static bool CalcContextParams(ALCcontext *Context) ALlistener &Listener = Context->Listener; struct ALcontextProps *props; - props = static_cast<ALcontextProps*>(ATOMIC_EXCHANGE_PTR(&Context->Update, - static_cast<ALcontextProps*>(nullptr), almemory_order_acq_rel)); + props = ATOMIC_EXCHANGE(&Context->Update, static_cast<ALcontextProps*>(nullptr), + almemory_order_acq_rel); if(!props) return false; Listener.Params.MetersPerUnit = props->MetersPerUnit; @@ -341,8 +341,8 @@ static bool CalcListenerParams(ALCcontext *Context) struct ALlistenerProps *props; aluVector vel; - props = static_cast<ALlistenerProps*>(ATOMIC_EXCHANGE_PTR(&Listener.Update, - static_cast<ALlistenerProps*>(nullptr), almemory_order_acq_rel)); + props = ATOMIC_EXCHANGE(&Listener.Update, static_cast<ALlistenerProps*>(nullptr), + almemory_order_acq_rel); if(!props) return false; /* AT then UP */ @@ -385,8 +385,8 @@ static bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool f struct ALeffectslotProps *props; ALeffectState *state; - props = static_cast<ALeffectslotProps*>(ATOMIC_EXCHANGE_PTR(&slot->Update, - static_cast<ALeffectslotProps*>(nullptr), almemory_order_acq_rel)); + props = ATOMIC_EXCHANGE(&slot->Update, static_cast<ALeffectslotProps*>(nullptr), + almemory_order_acq_rel); if(!props && !force) return false; if(props) @@ -1455,8 +1455,8 @@ static void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) ALbufferlistitem *BufferListItem; struct ALvoiceProps *props; - props = static_cast<ALvoiceProps*>(ATOMIC_EXCHANGE_PTR(&voice->Update, - static_cast<ALvoiceProps*>(nullptr), almemory_order_acq_rel)); + props = ATOMIC_EXCHANGE(&voice->Update, static_cast<ALvoiceProps*>(nullptr), + almemory_order_acq_rel); if(!props && !force) return; if(props) @@ -1857,10 +1857,8 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) for(i = 0;i < ctx->VoiceCount;i++) { ALvoice *voice = ctx->Voices[i]; - ALsource *source; - - source = static_cast<ALsource*>(ATOMIC_EXCHANGE_PTR(&voice->Source, - static_cast<ALsource*>(nullptr), almemory_order_relaxed)); + ALsource *source = ATOMIC_EXCHANGE(&voice->Source, static_cast<ALsource*>(nullptr), + almemory_order_relaxed); if(source && ATOMIC_LOAD(&voice->Playing, almemory_order_relaxed)) { /* If the source's voice was playing, it's now effectively |