mirror of https://github.com/PCSX2/pcsx2.git
MTVU: port ScopedLockBool to std::atomic
This commit is contained in:
parent
3a4787dd98
commit
ca8955daf3
|
@ -402,15 +402,11 @@ namespace Threading
|
||||||
// Note that the isLockedBool should only be used as an indicator for the locked status,
|
// Note that the isLockedBool should only be used as an indicator for the locked status,
|
||||||
// and not actually depended on for thread synchronization...
|
// and not actually depended on for thread synchronization...
|
||||||
|
|
||||||
struct ScopedLockBool {
|
struct ScopedLockBool {
|
||||||
ScopedLock m_lock;
|
ScopedLock m_lock;
|
||||||
volatile __aligned(4) bool& m_bool;
|
std::atomic<bool>& m_bool;
|
||||||
|
|
||||||
#ifdef __linux__
|
ScopedLockBool(Mutex& mutexToLock, std::atomic<bool>& isLockedBool)
|
||||||
ScopedLockBool(Mutex& mutexToLock, volatile bool& isLockedBool)
|
|
||||||
#else
|
|
||||||
ScopedLockBool(Mutex& mutexToLock, volatile __aligned(4) bool& isLockedBool)
|
|
||||||
#endif
|
|
||||||
: m_lock(mutexToLock),
|
: m_lock(mutexToLock),
|
||||||
m_bool(isLockedBool) {
|
m_bool(isLockedBool) {
|
||||||
m_bool = m_lock.IsLocked();
|
m_bool = m_lock.IsLocked();
|
||||||
|
|
|
@ -31,7 +31,7 @@ class VU_Thread : public pxThread {
|
||||||
static const u32 buffer_mask = buffer_size - 1;
|
static const u32 buffer_mask = buffer_size - 1;
|
||||||
__aligned(4) u32 buffer[buffer_size];
|
__aligned(4) u32 buffer[buffer_size];
|
||||||
__aligned(4) std::atomic<int> read_pos; // Only modified by VU thread
|
__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_pos; // Only modified by EE thread
|
||||||
__aligned(4) s32 write_offset; // Only modified by EE thread
|
__aligned(4) s32 write_offset; // Only modified by EE thread
|
||||||
__aligned(4) Mutex mtxBusy;
|
__aligned(4) Mutex mtxBusy;
|
||||||
|
|
Loading…
Reference in New Issue