From 40b1a3996a00eb540b26209c2d5d180c6af819bb Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 22 Feb 2016 21:58:13 +0100 Subject: [PATCH] VU: port BaseVUmicroCPU to std::atomic --- pcsx2/VUmicro.h | 4 ++-- pcsx2/x86/microVU.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pcsx2/VUmicro.h b/pcsx2/VUmicro.h index f0943f6144..27cdeb1030 100644 --- a/pcsx2/VUmicro.h +++ b/pcsx2/VUmicro.h @@ -49,7 +49,7 @@ class BaseCpuProvider protected: // allocation counter for multiple calls to Reserve. Most implementations should utilize // this variable for sake of robustness. - u32 m_Reserved; + std::atomic m_Reserved; public: // this boolean indicates to some generic logging facilities if the VU's registers @@ -68,7 +68,7 @@ public: { try { if( m_Reserved != 0 ) - Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved ); + Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved.load() ); } DESTRUCTOR_CATCHALL } diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index 68bb970ef1..8e61974523 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -297,22 +297,22 @@ void recMicroVU0::Vsync() throw() { mVUvsyncUpdate(microVU0); } void recMicroVU1::Vsync() throw() { mVUvsyncUpdate(microVU1); } void recMicroVU0::Reserve() { - if (AtomicExchange(m_Reserved, 1) == 0) + if (m_Reserved.exchange(1) == 0) mVUinit(microVU0, 0); } void recMicroVU1::Reserve() { - if (AtomicExchange(m_Reserved, 1) == 0) { + if (m_Reserved.exchange(1) == 0) { mVUinit(microVU1, 1); vu1Thread.Start(); } } void recMicroVU0::Shutdown() throw() { - if (AtomicExchange(m_Reserved, 0) == 1) + if (m_Reserved.exchange(0) == 1) mVUclose(microVU0); } void recMicroVU1::Shutdown() throw() { - if (AtomicExchange(m_Reserved, 0) == 1) { + if (m_Reserved.exchange(0) == 1) { vu1Thread.WaitVU(); mVUclose(microVU1); }