MTVU: Fix hang on shutdown if thread never opened

This commit is contained in:
Connor McLaughlin 2022-10-27 22:36:36 +10:00 committed by refractionpcsx2
parent dcbb1483b9
commit c44266eb82
2 changed files with 4 additions and 2 deletions

View File

@ -100,7 +100,7 @@ VU_Thread::~VU_Thread()
void VU_Thread::Open() void VU_Thread::Open()
{ {
if (m_thread.Joinable()) if (IsOpen())
return; return;
Reset(); Reset();
@ -111,7 +111,7 @@ void VU_Thread::Open()
void VU_Thread::Close() void VU_Thread::Close()
{ {
if (!m_thread.Joinable()) if (!IsOpen())
return; return;
m_shutdown_flag.store(true, std::memory_order_release); m_shutdown_flag.store(true, std::memory_order_release);

View File

@ -66,6 +66,8 @@ public:
~VU_Thread(); ~VU_Thread();
__fi const Threading::ThreadHandle& GetThreadHandle() const { return m_thread; } __fi const Threading::ThreadHandle& GetThreadHandle() const { return m_thread; }
/// Returns true if the VU thread has been started.
__fi bool IsOpen() const { return m_thread.Joinable(); } __fi bool IsOpen() const { return m_thread.Joinable(); }
/// Ensures the VU thread is started. /// Ensures the VU thread is started.