MTVU: port ScopedLockBool to std::atomic

This commit is contained in:
Gregory Hainaut 2016-02-22 22:36:29 +01:00
parent 3a4787dd98
commit ca8955daf3
2 changed files with 4 additions and 8 deletions

View File

@ -402,15 +402,11 @@ namespace Threading
// Note that the isLockedBool should only be used as an indicator for the locked status,
// and not actually depended on for thread synchronization...
struct ScopedLockBool {
struct ScopedLockBool {
ScopedLock m_lock;
volatile __aligned(4) bool& m_bool;
std::atomic<bool>& m_bool;
#ifdef __linux__
ScopedLockBool(Mutex& mutexToLock, volatile bool& isLockedBool)
#else
ScopedLockBool(Mutex& mutexToLock, volatile __aligned(4) bool& isLockedBool)
#endif
ScopedLockBool(Mutex& mutexToLock, std::atomic<bool>& isLockedBool)
: m_lock(mutexToLock),
m_bool(isLockedBool) {
m_bool = m_lock.IsLocked();

View File

@ -31,7 +31,7 @@ class VU_Thread : public pxThread {
static const u32 buffer_mask = buffer_size - 1;
__aligned(4) u32 buffer[buffer_size];
__aligned(4) std::atomic<int> read_pos; // Only modified by VU thread
__aligned(4) volatile bool isBusy; // Is thread processing data?
__aligned(4) std::atomic<bool> isBusy; // Is thread processing data?
__aligned(4) s32 write_pos; // Only modified by EE thread
__aligned(4) s32 write_offset; // Only modified by EE thread
__aligned(4) Mutex mtxBusy;