emu_thread: properly force shutdown for unresponsive guest programs
This commit is contained in:
parent
f44c60321e
commit
179adee396
2 changed files with 5 additions and 12 deletions
|
@ -11,7 +11,6 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
|
||||||
#include <QTouchEvent>
|
#include <QTouchEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
@ -85,17 +84,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests for the emulation thread to stop running
|
* Requests for the emulation thread to immediately stop running
|
||||||
*/
|
*/
|
||||||
void RequestStop() {
|
|
||||||
QTimer::singleShot(5000, this, &EmuThread::ForceStop);
|
|
||||||
}
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void ForceStop() {
|
void ForceStop() {
|
||||||
if (!IsRunning()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOG_WARNING(Frontend, "Force stopping EmuThread");
|
LOG_WARNING(Frontend, "Force stopping EmuThread");
|
||||||
stop_source.request_stop();
|
stop_source.request_stop();
|
||||||
SetRunning(false);
|
SetRunning(false);
|
||||||
|
|
|
@ -1792,12 +1792,14 @@ void GMainWindow::ShutdownGame() {
|
||||||
discord_rpc->Pause();
|
discord_rpc->Pause();
|
||||||
|
|
||||||
RequestGameExit();
|
RequestGameExit();
|
||||||
emu_thread->RequestStop();
|
|
||||||
|
|
||||||
emit EmulationStopping();
|
emit EmulationStopping();
|
||||||
|
|
||||||
// Wait for emulation thread to complete and delete it
|
// Wait for emulation thread to complete and delete it
|
||||||
|
if (!emu_thread->wait(5000)) {
|
||||||
|
emu_thread->ForceStop();
|
||||||
emu_thread->wait();
|
emu_thread->wait();
|
||||||
|
}
|
||||||
emu_thread = nullptr;
|
emu_thread = nullptr;
|
||||||
|
|
||||||
emulation_running = false;
|
emulation_running = false;
|
||||||
|
|
Loading…
Reference in a new issue