From 65f7fc610e6a6101509906c0c9bbbd794c9a3737 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 1 Aug 2019 13:28:53 -0700 Subject: Add a common base for auto-deleting ref-counted objects Which will also work as the basis for a future intrusive_ptr --- alc/backends/base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'alc/backends/base.cpp') diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index 78b9196e..095990b7 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -43,11 +43,11 @@ ClockLatency BackendBase::getClockLatency() ALuint refcount; do { - while(((refcount=mDevice->MixCount.load(std::memory_order_acquire))&1)) + while(((refcount=ReadRef(mDevice->MixCount))&1) != 0) std::this_thread::yield(); ret.ClockTime = GetDeviceClockTime(mDevice); std::atomic_thread_fence(std::memory_order_acquire); - } while(refcount != mDevice->MixCount.load(std::memory_order_relaxed)); + } while(refcount != ReadRef(mDevice->MixCount)); /* NOTE: The device will generally have about all but one periods filled at * any given time during playback. Without a more accurate measurement from -- cgit v1.2.3