Qt: Create emu thread on bootup, kill it on shutdown.
This commit is contained in:
parent
d5665fea89
commit
28df8dbfeb
3 changed files with 44 additions and 31 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue