mirror of https://github.com/PCSX2/pcsx2.git
clang-format: AppCoreThread.h
This commit is contained in:
parent
0dee88e805
commit
593e44ca54
|
@ -23,19 +23,19 @@
|
||||||
#include "SaveState.h"
|
#include "SaveState.h"
|
||||||
|
|
||||||
#define AffinityAssert_AllowFrom_CoreThread() \
|
#define AffinityAssert_AllowFrom_CoreThread() \
|
||||||
pxAssertMsg( GetCoreThread().IsSelf(), "Thread affinity violation: Call allowed from SysCoreThread only." )
|
pxAssertMsg(GetCoreThread().IsSelf(), "Thread affinity violation: Call allowed from SysCoreThread only.")
|
||||||
|
|
||||||
#define AffinityAssert_DisallowFrom_CoreThread() \
|
#define AffinityAssert_DisallowFrom_CoreThread() \
|
||||||
pxAssertMsg( !GetCoreThread().IsSelf(), "Thread affinity violation: Call is *not* allowed from SysCoreThread." )
|
pxAssertMsg(!GetCoreThread().IsSelf(), "Thread affinity violation: Call is *not* allowed from SysCoreThread.")
|
||||||
|
|
||||||
class IScopedCoreThread;
|
class IScopedCoreThread;
|
||||||
class BaseScopedCoreThread;
|
class BaseScopedCoreThread;
|
||||||
|
|
||||||
enum ScopedCoreResumeType
|
enum ScopedCoreResumeType
|
||||||
{
|
{
|
||||||
ScopedCore_BlockingResume
|
ScopedCore_BlockingResume,
|
||||||
, ScopedCore_NonblockingResume
|
ScopedCore_NonblockingResume,
|
||||||
, ScopedCore_SkipResume
|
ScopedCore_SkipResume
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace GameInfo
|
namespace GameInfo
|
||||||
|
@ -50,20 +50,20 @@ namespace GameInfo
|
||||||
class BaseSysExecEvent_ScopedCore : public SysExecEvent
|
class BaseSysExecEvent_ScopedCore : public SysExecEvent
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
SynchronousActionState* m_resume;
|
SynchronousActionState* m_resume;
|
||||||
Threading::Mutex* m_mtx_resume;
|
Threading::Mutex* m_mtx_resume;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BaseSysExecEvent_ScopedCore() = default;
|
virtual ~BaseSysExecEvent_ScopedCore() = default;
|
||||||
|
|
||||||
BaseSysExecEvent_ScopedCore& SetResumeStates( SynchronousActionState* sync, Threading::Mutex* mutex )
|
BaseSysExecEvent_ScopedCore& SetResumeStates(SynchronousActionState* sync, Threading::Mutex* mutex)
|
||||||
{
|
{
|
||||||
m_resume = sync;
|
m_resume = sync;
|
||||||
m_mtx_resume = mutex;
|
m_mtx_resume = mutex;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseSysExecEvent_ScopedCore& SetResumeStates( SynchronousActionState& sync, Threading::Mutex& mutex )
|
BaseSysExecEvent_ScopedCore& SetResumeStates(SynchronousActionState& sync, Threading::Mutex& mutex)
|
||||||
{
|
{
|
||||||
m_resume = &sync;
|
m_resume = &sync;
|
||||||
m_mtx_resume = &mutex;
|
m_mtx_resume = &mutex;
|
||||||
|
@ -71,14 +71,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BaseSysExecEvent_ScopedCore( SynchronousActionState* sync=NULL, SynchronousActionState* resume_sync=NULL, Threading::Mutex* mtx_resume=NULL )
|
BaseSysExecEvent_ScopedCore(SynchronousActionState* sync = NULL, SynchronousActionState* resume_sync = NULL, Threading::Mutex* mtx_resume = NULL)
|
||||||
: SysExecEvent( sync )
|
: SysExecEvent(sync)
|
||||||
{
|
{
|
||||||
m_resume = resume_sync;
|
m_resume = resume_sync;
|
||||||
m_mtx_resume = mtx_resume;
|
m_mtx_resume = mtx_resume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _post_and_wait( IScopedCoreThread& core );
|
void _post_and_wait(IScopedCoreThread& core);
|
||||||
|
|
||||||
virtual void DoScopedTask() {}
|
virtual void DoScopedTask() {}
|
||||||
};
|
};
|
||||||
|
@ -93,10 +93,12 @@ public:
|
||||||
wxString GetEventName() const { return L"CloseCoreThread"; }
|
wxString GetEventName() const { return L"CloseCoreThread"; }
|
||||||
|
|
||||||
virtual ~SysExecEvent_CoreThreadClose() = default;
|
virtual ~SysExecEvent_CoreThreadClose() = default;
|
||||||
SysExecEvent_CoreThreadClose* Clone() const { return new SysExecEvent_CoreThreadClose( *this ); }
|
SysExecEvent_CoreThreadClose* Clone() const { return new SysExecEvent_CoreThreadClose(*this); }
|
||||||
|
|
||||||
SysExecEvent_CoreThreadClose( SynchronousActionState* sync=NULL, SynchronousActionState* resume_sync=NULL, Threading::Mutex* mtx_resume=NULL )
|
SysExecEvent_CoreThreadClose(SynchronousActionState* sync = NULL, SynchronousActionState* resume_sync = NULL, Threading::Mutex* mtx_resume = NULL)
|
||||||
: BaseSysExecEvent_ScopedCore( sync, resume_sync, mtx_resume ) { }
|
: BaseSysExecEvent_ScopedCore(sync, resume_sync, mtx_resume)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InvokeEvent();
|
void InvokeEvent();
|
||||||
|
@ -111,10 +113,12 @@ public:
|
||||||
wxString GetEventName() const { return L"PauseCoreThread"; }
|
wxString GetEventName() const { return L"PauseCoreThread"; }
|
||||||
|
|
||||||
virtual ~SysExecEvent_CoreThreadPause() = default;
|
virtual ~SysExecEvent_CoreThreadPause() = default;
|
||||||
SysExecEvent_CoreThreadPause* Clone() const { return new SysExecEvent_CoreThreadPause( *this ); }
|
SysExecEvent_CoreThreadPause* Clone() const { return new SysExecEvent_CoreThreadPause(*this); }
|
||||||
|
|
||||||
SysExecEvent_CoreThreadPause( SynchronousActionState* sync=NULL, SynchronousActionState* resume_sync=NULL, Threading::Mutex* mtx_resume=NULL )
|
SysExecEvent_CoreThreadPause(SynchronousActionState* sync = NULL, SynchronousActionState* resume_sync = NULL, Threading::Mutex* mtx_resume = NULL)
|
||||||
: BaseSysExecEvent_ScopedCore( sync, resume_sync, mtx_resume ) { }
|
: BaseSysExecEvent_ScopedCore(sync, resume_sync, mtx_resume)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InvokeEvent();
|
void InvokeEvent();
|
||||||
|
@ -136,16 +140,16 @@ public:
|
||||||
|
|
||||||
void ResetCdvd() { m_resetCdvd = true; }
|
void ResetCdvd() { m_resetCdvd = true; }
|
||||||
|
|
||||||
virtual void Suspend( bool isBlocking=false );
|
virtual void Suspend(bool isBlocking = false);
|
||||||
virtual void Resume();
|
virtual void Resume();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void ResetQuick();
|
virtual void ResetQuick();
|
||||||
virtual void Cancel( bool isBlocking=true );
|
virtual void Cancel(bool isBlocking = true);
|
||||||
virtual bool StateCheckInThread();
|
virtual bool StateCheckInThread();
|
||||||
virtual void ChangeCdvdSource();
|
virtual void ChangeCdvdSource();
|
||||||
|
|
||||||
virtual void ApplySettings( const Pcsx2Config& src );
|
virtual void ApplySettings(const Pcsx2Config& src);
|
||||||
virtual void UploadStateCopy( const VmStateBuffer& copy );
|
virtual void UploadStateCopy(const VmStateBuffer& copy);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoCpuExecute();
|
virtual void DoCpuExecute();
|
||||||
|
@ -153,7 +157,7 @@ protected:
|
||||||
virtual void OnResumeReady();
|
virtual void OnResumeReady();
|
||||||
virtual void OnPause();
|
virtual void OnPause();
|
||||||
virtual void OnPauseDebug();
|
virtual void OnPauseDebug();
|
||||||
virtual void OnResumeInThread( bool IsSuspended );
|
virtual void OnResumeInThread(bool IsSuspended);
|
||||||
virtual void OnSuspendInThread();
|
virtual void OnSuspendInThread();
|
||||||
virtual void OnCleanupInThread();
|
virtual void OnCleanupInThread();
|
||||||
virtual void VsyncInThread();
|
virtual void VsyncInThread();
|
||||||
|
@ -171,31 +175,32 @@ protected:
|
||||||
IScopedCoreThread() {}
|
IScopedCoreThread() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~IScopedCoreThread() = default;;
|
virtual ~IScopedCoreThread() = default;
|
||||||
virtual void AllowResume()=0;
|
;
|
||||||
virtual void DisallowResume()=0;
|
virtual void AllowResume() = 0;
|
||||||
|
virtual void DisallowResume() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseScopedCoreThread : public IScopedCoreThread
|
class BaseScopedCoreThread : public IScopedCoreThread
|
||||||
{
|
{
|
||||||
DeclareNoncopyableObject( BaseScopedCoreThread );
|
DeclareNoncopyableObject(BaseScopedCoreThread);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_allowResume;
|
bool m_allowResume;
|
||||||
bool m_alreadyStopped;
|
bool m_alreadyStopped;
|
||||||
bool m_alreadyScoped;
|
bool m_alreadyScoped;
|
||||||
SynchronousActionState m_sync;
|
SynchronousActionState m_sync;
|
||||||
SynchronousActionState m_sync_resume;
|
SynchronousActionState m_sync_resume;
|
||||||
Threading::Mutex m_mtx_resume;
|
Threading::Mutex m_mtx_resume;
|
||||||
|
|
||||||
BaseScopedCoreThread();
|
BaseScopedCoreThread();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BaseScopedCoreThread() =0;
|
virtual ~BaseScopedCoreThread() = 0;
|
||||||
virtual void AllowResume();
|
virtual void AllowResume();
|
||||||
virtual void DisallowResume();
|
virtual void DisallowResume();
|
||||||
|
|
||||||
virtual bool PostToSysExec( BaseSysExecEvent_ScopedCore* msg );
|
virtual bool PostToSysExec(BaseSysExecEvent_ScopedCore* msg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called from destructors -- do not make virtual!!
|
// Called from destructors -- do not make virtual!!
|
||||||
|
@ -236,14 +241,14 @@ struct ScopedCoreThreadPause : public BaseScopedCoreThread
|
||||||
typedef BaseScopedCoreThread _parent;
|
typedef BaseScopedCoreThread _parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse_me=NULL );
|
ScopedCoreThreadPause(BaseSysExecEvent_ScopedCore* abuse_me = NULL);
|
||||||
virtual ~ScopedCoreThreadPause();
|
virtual ~ScopedCoreThreadPause();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScopedCoreThreadPopup : public IScopedCoreThread
|
struct ScopedCoreThreadPopup : public IScopedCoreThread
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<BaseScopedCoreThread> m_scoped_core;
|
std::unique_ptr<BaseScopedCoreThread> m_scoped_core;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScopedCoreThreadPopup();
|
ScopedCoreThreadPopup();
|
||||||
|
|
Loading…
Reference in New Issue