mirror of https://github.com/PCSX2/pcsx2.git
System: port to std::atomic
v2: use an explicit int type for clang // multiple conversions from switch condition type // 'std::atomic<ExecutionMode>' to an integral or enumeration type v3/v4: use .load to read variable (clang 3.7) v5: add back 'std::atomic<ExecutionMode>' now that .load is used everywhere
This commit is contained in:
parent
34826c9506
commit
92078b1c58
|
@ -91,7 +91,7 @@ void SysThreadBase::Suspend( bool isBlocking )
|
|||
{
|
||||
ScopedLock locker( m_ExecModeMutex );
|
||||
|
||||
switch( m_ExecMode )
|
||||
switch( m_ExecMode.load() )
|
||||
{
|
||||
// Invalid thread state, nothing to suspend
|
||||
case ExecMode_NoThreadYet:
|
||||
|
@ -196,7 +196,7 @@ void SysThreadBase::Resume()
|
|||
// sanity checks against m_ExecMode/m_Running status, and if something doesn't feel
|
||||
// right, we should abort; the user may have canceled the action before it even finished.
|
||||
|
||||
switch( m_ExecMode )
|
||||
switch( m_ExecMode.load() )
|
||||
{
|
||||
case ExecMode_Opened: return;
|
||||
|
||||
|
@ -267,7 +267,7 @@ void SysThreadBase::OnResumeInThread( bool isSuspended ) {}
|
|||
// continued execution unimpeded.
|
||||
bool SysThreadBase::StateCheckInThread()
|
||||
{
|
||||
switch( m_ExecMode )
|
||||
switch( m_ExecMode.load() )
|
||||
{
|
||||
|
||||
#ifdef PCSX2_DEVBUILD // optimize out handlers for these cases in release builds.
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
volatile ExecutionMode m_ExecMode;
|
||||
std::atomic<ExecutionMode> m_ExecMode;
|
||||
|
||||
// This lock is used to avoid simultaneous requests to Suspend/Resume/Pause from
|
||||
// contending threads.
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
return m_ExecMode >= ExecMode_Closing;
|
||||
}
|
||||
|
||||
ExecutionMode GetExecutionMode() const { return m_ExecMode; }
|
||||
ExecutionMode GetExecutionMode() const { return m_ExecMode.load(); }
|
||||
Mutex& ExecutionModeMutex() { return m_ExecModeMutex; }
|
||||
|
||||
virtual void Suspend( bool isBlocking = true );
|
||||
|
@ -172,7 +172,7 @@ protected:
|
|||
// true anytime between plugins being initialized and plugins being shutdown. Gets
|
||||
// set false when plugins are shutdown, the corethread is canceled, or when an error
|
||||
// occurs while trying to upload a new state into the VM.
|
||||
volatile bool m_hasActiveMachine;
|
||||
std::atomic<bool> m_hasActiveMachine;
|
||||
|
||||
wxString m_elf_override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue