diff options
author | Chris Robinson <[email protected]> | 2022-02-13 21:00:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-02-13 21:00:57 -0800 |
commit | 3e6d210767e432c780f892b2365f3644456b61b3 (patch) | |
tree | 2f914604efa03749d87d42a8257864bf42ad21ba /alc/context.h | |
parent | cdae6de6891f783fc5089ff82b9284f4a2c71e5b (diff) |
Avoid more unnecessary atomics
Diffstat (limited to 'alc/context.h')
-rw-r--r-- | alc/context.h | 9 |
1 files changed, 4 insertions, 5 deletions
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(); } |