diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/context.cpp | 11 | ||||
-rw-r--r-- | alc/context.h | 9 |
3 files changed, 10 insertions, 12 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 23bbb554..4c8d0a6c 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2155,7 +2155,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) context->mFreeVoiceProps.store(nullptr, std::memory_order_relaxed); srclock.unlock(); - context->mPropsDirty.test_and_clear(std::memory_order_release); + context->mPropsDirty = false; UpdateContextProps(context); UpdateAllSourceProps(context); } diff --git a/alc/context.cpp b/alc/context.cpp index 07dc76bf..c21bd1b9 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -114,7 +114,6 @@ void ALCcontext::setThreadContext(ALCcontext *context) noexcept ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device) : ContextBase{device.get()}, mALDevice{std::move(device)} { - mPropsDirty.test_and_clear(std::memory_order_relaxed); } ALCcontext::~ALCcontext() @@ -258,7 +257,7 @@ void ALCcontext::applyAllUpdates() /* busy-wait */ } - if(mPropsDirty.test_and_clear(std::memory_order_acq_rel)) + if(std::exchange(mPropsDirty, false)) UpdateContextProps(this); UpdateAllEffectSlotProps(this); UpdateAllSourceProps(this); @@ -908,13 +907,13 @@ void ALCcontext::eax_set_primary_fx_slot_id() void ALCcontext::eax_set_distance_factor() { mListener.mMetersPerUnit = eax_.context.flDistanceFactor; - mPropsDirty.set(std::memory_order_release); + mPropsDirty = true; } void ALCcontext::eax_set_air_absorbtion_hf() { mAirAbsorptionGainHF = eax_.context.flAirAbsorptionHF; - mPropsDirty.set(std::memory_order_release); + mPropsDirty = true; } void ALCcontext::eax_set_hf_reference() @@ -1285,14 +1284,14 @@ void ALCcontext::eax_set( if (!eax_call.is_deferred()) { eax_apply_deferred(); - if(!mDeferUpdates.load(std::memory_order_acquire)) + if(!mDeferUpdates) { mHoldUpdates.store(true, std::memory_order_release); while((mUpdateCount.load(std::memory_order_acquire)&1) != 0) { /* busy-wait */ } - if(mPropsDirty.test_and_clear(std::memory_order_acq_rel)) + if(std::exchange(mPropsDirty, false)) UpdateContextProps(this); UpdateAllSourceProps(this); diff --git a/alc/context.h b/alc/context.h index bd966704..64c484a8 100644 --- a/alc/context.h +++ b/alc/context.h @@ -102,8 +102,8 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { al::vector<WetBufferPtr> mWetBuffers; - al::atomic_invflag mPropsDirty; - std::atomic<bool> mDeferUpdates{false}; + bool mPropsDirty{true}; + bool mDeferUpdates{false}; std::mutex mPropLock; @@ -155,8 +155,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { * This does *NOT* stop mixing, but rather prevents certain property * changes from taking effect. mPropLock must be held when called. */ - bool deferUpdates() noexcept - { return mDeferUpdates.exchange(true, std::memory_order_acq_rel); } + void deferUpdates() noexcept { mDeferUpdates = true; } /** * Resumes update processing after being deferred. mPropLock must be held @@ -164,7 +163,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { */ void processUpdates() { - if(mDeferUpdates.exchange(false, std::memory_order_acq_rel)) + if(std::exchange(mDeferUpdates, false)) applyAllUpdates(); } |