summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2022-12-12 21:38:20 -0500
committerGravatar Liam2022-12-12 21:38:20 -0500
commit179adee396e6b8480d52be5314979830beebfbc1 (patch)
treea0cbfaf66a546f3717db1c3090af39d909f9800c /src
parentlet games gracefully exit (diff)
downloadyuzu-179adee396e6b8480d52be5314979830beebfbc1.tar.gz
yuzu-179adee396e6b8480d52be5314979830beebfbc1.tar.xz
yuzu-179adee396e6b8480d52be5314979830beebfbc1.zip
emu_thread: properly force shutdown for unresponsive guest programs
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.h11
-rw-r--r--src/yuzu/main.cpp6
2 files changed, 5 insertions, 12 deletions
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index c2b127f19..f0edad6e4 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -11,7 +11,6 @@
11#include <QImage> 11#include <QImage>
12#include <QStringList> 12#include <QStringList>
13#include <QThread> 13#include <QThread>
14#include <QTimer>
15#include <QTouchEvent> 14#include <QTouchEvent>
16#include <QWidget> 15#include <QWidget>
17 16
@@ -85,17 +84,9 @@ public:
85 } 84 }
86 85
87 /** 86 /**
88 * Requests for the emulation thread to stop running 87 * Requests for the emulation thread to immediately stop running
89 */ 88 */
90 void RequestStop() {
91 QTimer::singleShot(5000, this, &EmuThread::ForceStop);
92 }
93
94private slots:
95 void ForceStop() { 89 void ForceStop() {
96 if (!IsRunning()) {
97 return;
98 }
99 LOG_WARNING(Frontend, "Force stopping EmuThread"); 90 LOG_WARNING(Frontend, "Force stopping EmuThread");
100 stop_source.request_stop(); 91 stop_source.request_stop();
101 SetRunning(false); 92 SetRunning(false);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b38957d9a..b3ae03eaf 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1792,12 +1792,14 @@ void GMainWindow::ShutdownGame() {
1792 discord_rpc->Pause(); 1792 discord_rpc->Pause();
1793 1793
1794 RequestGameExit(); 1794 RequestGameExit();
1795 emu_thread->RequestStop();
1796 1795
1797 emit EmulationStopping(); 1796 emit EmulationStopping();
1798 1797
1799 // Wait for emulation thread to complete and delete it 1798 // Wait for emulation thread to complete and delete it
1800 emu_thread->wait(); 1799 if (!emu_thread->wait(5000)) {
1800 emu_thread->ForceStop();
1801 emu_thread->wait();
1802 }
1801 emu_thread = nullptr; 1803 emu_thread = nullptr;
1802 1804
1803 emulation_running = false; 1805 emulation_running = false;