From e4ea133717a5292339c134160da984ba186d3de8 Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 28 Apr 2015 19:03:01 -0400 Subject: Qt: Restructured to remove unnecessary shutdown event and various cleanups. --- src/citra_qt/bootmanager.h | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) (limited to 'src/citra_qt/bootmanager.h') diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index f6f09773..e9b3ea66 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -25,66 +25,46 @@ public: /** * Start emulation (on new thread) - * * @warning Only call when not running! */ void run() override; /** - * Allow the CPU to process a single instruction (if cpu is not running) - * + * Steps the emulation thread by a single CPU instruction (if the CPU is not already running) * @note This function is thread-safe */ - void ExecStep() { exec_cpu_step = true; } + void ExecStep() { exec_step = true; } /** - * Sets whether the CPU is running - * + * Sets whether the emulation thread is running or not + * @param running Boolean value, set the emulation thread to running if true * @note This function is thread-safe */ - void SetCpuRunning(bool running) { cpu_running = running; } + void SetRunning(bool running) { this->running = running; } /** - * Allow the CPU to continue processing instructions without interruption - * + * Check if the emulation thread is running or not + * @return True if the emulation thread is running, otherwise false * @note This function is thread-safe */ - bool IsCpuRunning() { return cpu_running; } - - - /** - * Shutdown (permantently stops) the CPU - */ - void ShutdownCpu() { stop_run = true; }; + bool IsRunning() { return running; } /** - * Waits for the CPU shutdown to complete + * Shutdown (permanently stops) the emulation thread */ - void WaitForCpuShutdown() { shutdown_event.Wait(); } - - -public slots: - /** - * Stop emulation and wait for the thread to finish. - * - * @details: This function will wait a second for the thread to finish; if it hasn't finished until then, we'll terminate() it and wait another second, hoping that it will be terminated by then. - * @note: This function is thread-safe. - */ - void Stop(); + void Shutdown() { stop_run = true; }; private: friend class GMainWindow; EmuThread(GRenderWindow* render_window); - bool exec_cpu_step; - bool cpu_running; + bool exec_step; + bool running; std::atomic stop_run; GRenderWindow* render_window; - Common::Event shutdown_event; - signals: /** * Emitted when the CPU has halted execution -- cgit v1.2.3