From 28df8dbfeb17cf5a002a5504a6bd2ba5091bf07c Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 16 Apr 2015 23:31:14 -0400 Subject: Qt: Create emu thread on bootup, kill it on shutdown. --- src/citra_qt/bootmanager.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/citra_qt/bootmanager.h') diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 8083d275b..f6f09773c 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -9,6 +9,7 @@ #include "common/common.h" #include "common/emu_window.h" +#include "common/thread.h" class QScreen; class QKeyEvent; @@ -37,20 +38,31 @@ public: void ExecStep() { exec_cpu_step = true; } /** - * Allow the CPU to continue processing instructions without interruption + * Sets whether the CPU is running * * @note This function is thread-safe */ void SetCpuRunning(bool running) { cpu_running = running; } /** - * Allow the CPU to continue processing instructions without interruption - * - * @note This function is thread-safe - */ + * Allow the CPU to continue processing instructions without interruption + * + * @note This function is thread-safe + */ bool IsCpuRunning() { return cpu_running; } + /** + * Shutdown (permantently stops) the CPU + */ + void ShutdownCpu() { stop_run = true; }; + + /** + * Waits for the CPU shutdown to complete + */ + void WaitForCpuShutdown() { shutdown_event.Wait(); } + + public slots: /** * Stop emulation and wait for the thread to finish. @@ -71,6 +83,8 @@ private: GRenderWindow* render_window; + Common::Event shutdown_event; + signals: /** * Emitted when the CPU has halted execution -- cgit v1.2.3