From b6a68e8d510610e181d638ff993e327059bd6018 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 3 Dec 2023 23:36:07 -0800 Subject: Remove some unnecessary atomic wrappers --- alc/alc.cpp | 3 ++- alc/backends/base.cpp | 2 +- alc/backends/pipewire.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'alc') diff --git a/alc/alc.cpp b/alc/alc.cpp index ab4cc7ba..d974777b 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2514,7 +2514,8 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, refcount = dev->waitForMix(); basecount = dev->mClockBase.load(std::memory_order_relaxed); samplecount = dev->mSamplesDone.load(std::memory_order_relaxed); - } while(refcount != ReadRef(dev->MixCount)); + std::atomic_thread_fence(std::memory_order_acquire); + } while(refcount != dev->MixCount.load(std::memory_order_relaxed)); basecount += nanoseconds{seconds{samplecount}} / dev->Frequency; *values = basecount.count(); } diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index 675d8043..b2b567a6 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -52,7 +52,7 @@ ClockLatency BackendBase::getClockLatency() refcount = mDevice->waitForMix(); ret.ClockTime = mDevice->getClockTime(); std::atomic_thread_fence(std::memory_order_acquire); - } while(refcount != ReadRef(mDevice->MixCount)); + } while(refcount != mDevice->MixCount.load(std::memory_order_relaxed)); /* NOTE: The device will generally have about all but one periods filled at * any given time during playback. Without a more accurate measurement from diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index e2f32758..754feb6c 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -1827,7 +1827,7 @@ ClockLatency PipeWirePlayback::getClockLatency() mixtime = mDevice->getClockTime(); clock_gettime(CLOCK_MONOTONIC, &tspec); std::atomic_thread_fence(std::memory_order_acquire); - } while(refcount != ReadRef(mDevice->MixCount)); + } while(refcount != mDevice->MixCount.load(std::memory_order_relaxed)); /* Convert the monotonic clock, stream ticks, and stream delay to * nanoseconds. -- cgit v1.2.3