From c44266eb8223ca952d7ce8e44fd6adb839f6ee67 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 27 Oct 2022 22:36:36 +1000 Subject: [PATCH] MTVU: Fix hang on shutdown if thread never opened --- pcsx2/MTVU.cpp | 4 ++-- pcsx2/MTVU.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pcsx2/MTVU.cpp b/pcsx2/MTVU.cpp index 287c954068..26ec5bf3be 100644 --- a/pcsx2/MTVU.cpp +++ b/pcsx2/MTVU.cpp @@ -100,7 +100,7 @@ VU_Thread::~VU_Thread() void VU_Thread::Open() { - if (m_thread.Joinable()) + if (IsOpen()) return; Reset(); @@ -111,7 +111,7 @@ void VU_Thread::Open() void VU_Thread::Close() { - if (!m_thread.Joinable()) + if (!IsOpen()) return; m_shutdown_flag.store(true, std::memory_order_release); diff --git a/pcsx2/MTVU.h b/pcsx2/MTVU.h index b77d9af709..4215231084 100644 --- a/pcsx2/MTVU.h +++ b/pcsx2/MTVU.h @@ -66,6 +66,8 @@ public: ~VU_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(); } /// Ensures the VU thread is started.