aboutsummaryrefslogtreecommitdiffstats
path: root/core/context.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2024-01-01 10:53:52 -0800
committerChris Robinson <[email protected]>2024-01-01 10:53:52 -0800
commitaa23d619324ca7e9d51829a2cc5d276c98305eb9 (patch)
tree59aba746e891409b01655c332a5aa4887217176b /core/context.cpp
parenta03bfe04c16fa2df0ac86cde53154ca99c18ad53 (diff)
Make and use a (simple) atomic unique_ptr
Diffstat (limited to 'core/context.cpp')
-rw-r--r--core/context.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/context.cpp b/core/context.cpp
index b969583b..cb00ae70 100644
--- a/core/context.cpp
+++ b/core/context.cpp
@@ -52,7 +52,7 @@ ContextBase::~ContextBase()
if(std::unique_ptr<EffectSlotArray> curarray{mActiveAuxSlots.exchange(nullptr, std::memory_order_relaxed)})
std::destroy_n(curarray->end(), curarray->size());
- std::unique_ptr<ContextBase::VoiceArray>{mVoices.exchange(nullptr, std::memory_order_relaxed)};
+ mVoices.store(nullptr, std::memory_order_relaxed);
if(mAsyncEvents)
{
@@ -142,7 +142,7 @@ void ContextBase::allocVoices(size_t addcount)
voice_iter = std::transform(cluster->begin(), cluster->end(), voice_iter,
[](Voice &voice) noexcept -> Voice* { return &voice; });
- if(std::unique_ptr<ContextBase::VoiceArray> oldvoices{mVoices.exchange(newarray.release(), std::memory_order_acq_rel)})
+ if(auto oldvoices = mVoices.exchange(std::move(newarray), std::memory_order_acq_rel))
std::ignore = mDevice->waitForMix();
}