aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-03 23:36:07 -0800
committerChris Robinson <[email protected]>2023-12-03 23:36:07 -0800
commitb6a68e8d510610e181d638ff993e327059bd6018 (patch)
tree3c58b34d96036c3f6036bc96bc8a2f80015b1310 /core
parent859319fa7864ed6a81af1f12c68627ab58bb7a7d (diff)
Remove some unnecessary atomic wrappers
Diffstat (limited to 'core')
-rw-r--r--core/context.h2
-rw-r--r--core/device.h2
-rw-r--r--core/hrtf.cpp6
-rw-r--r--core/hrtf.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/core/context.h b/core/context.h
index ccb7dd3b..6f65663f 100644
--- a/core/context.h
+++ b/core/context.h
@@ -85,7 +85,7 @@ struct ContextBase {
/* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit
* indicates if updates are currently happening).
*/
- RefCount mUpdateCount{0u};
+ std::atomic<unsigned int> mUpdateCount{0u};
std::atomic<bool> mHoldUpdates{false};
std::atomic<bool> mStopVoicesOnDisconnect{true};
diff --git a/core/device.h b/core/device.h
index 842f1d82..1f3c5105 100644
--- a/core/device.h
+++ b/core/device.h
@@ -284,7 +284,7 @@ struct DeviceBase {
* the end, so the bottom bit indicates if the device is currently mixing
* and the upper bits indicates how many mixes have been done.
*/
- RefCount MixCount{0u};
+ std::atomic<uint> MixCount{0u};
// Contexts created on this device
std::atomic<al::FlexArray<ContextBase*>*> mContexts{nullptr};
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index 9a13a004..1b7da3f9 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -392,7 +392,7 @@ std::unique_ptr<HrtfStore> CreateHrtfStore(uint rate, uint8_t irSize,
if(void *ptr{al_calloc(16, total)})
{
Hrtf.reset(al::construct_at(static_cast<HrtfStore*>(ptr)));
- InitRef(Hrtf->mRef, 1u);
+ Hrtf->mRef.store(1u, std::memory_order_relaxed);
Hrtf->mSampleRate = rate & 0xff'ff'ff;
Hrtf->mIrSize = irSize;
@@ -1459,9 +1459,9 @@ void HrtfStore::dec_ref()
auto remove_unused = [](LoadedHrtf &hrtf) -> bool
{
HrtfStore *entry{hrtf.mEntry.get()};
- if(entry && ReadRef(entry->mRef) == 0)
+ if(entry && entry->mRef.load() == 0)
{
- TRACE("Unloading unused HRTF %s\n", hrtf.mFilename.data());
+ TRACE("Unloading unused HRTF %s\n", hrtf.mFilename.c_str());
hrtf.mEntry = nullptr;
return true;
}
diff --git a/core/hrtf.h b/core/hrtf.h
index 5e6e09a8..50c4f450 100644
--- a/core/hrtf.h
+++ b/core/hrtf.h
@@ -18,7 +18,7 @@
struct HrtfStore {
- RefCount mRef;
+ std::atomic<uint> mRef;
uint mSampleRate : 24;
uint mIrSize : 8;