mirror of https://github.com/PCSX2/pcsx2.git
VU: port BaseVUmicroCPU to std::atomic
This commit is contained in:
parent
8555a87380
commit
40b1a3996a
|
@ -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<int> 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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue