Thread interruption

This commit is contained in:
SimoneN64
2024-09-04 22:32:09 +02:00
parent e3a0f3fde4
commit 0d64601103
2 changed files with 7 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ EmuThread::EmuThread(const std::shared_ptr<QtInstanceFactory> &instance_,
} }
}; };
while (true) { while (!isInterruptionRequested()) {
if (!core.pause) { if (!core.pause) {
core.Run(settings.getVolumeL(), settings.getVolumeR()); core.Run(settings.getVolumeL(), settings.getVolumeR());
if (core.render) { if (core.render) {
@@ -108,4 +108,7 @@ EmuThread::EmuThread(const std::shared_ptr<QtInstanceFactory> &instance_,
pif.UpdateAxis(0, n64::Controller::Axis::X, xclamped); pif.UpdateAxis(0, n64::Controller::Axis::X, xclamped);
} }
} }
SetRender(false);
Stop();
} }

View File

@@ -60,9 +60,9 @@ void KaizenQt::LoadROM(const QString &fileName) noexcept {
void KaizenQt::Quit() noexcept { void KaizenQt::Quit() noexcept {
if (emuThread) { if (emuThread) {
emuThread->SetRender(false); emuThread->requestInterruption();
emuThread->Stop(); while (emuThread->isRunning())
emuThread->quit(); ;
} }
QApplication::quit(); QApplication::quit();
} }