summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sacha2014-08-25 03:42:52 +1000
committerGravatar Sacha2014-08-25 03:42:52 +1000
commit1b1205cf739d0913dd474779245fd59dccbf2fcf (patch)
tree64505f9f1dbe1d10b8b15661db8f2dc191d8ca98 /src
parentFix EmuThread loop by ensuring it exits properly. (diff)
downloadyuzu-1b1205cf739d0913dd474779245fd59dccbf2fcf.tar.gz
yuzu-1b1205cf739d0913dd474779245fd59dccbf2fcf.tar.xz
yuzu-1b1205cf739d0913dd474779245fd59dccbf2fcf.zip
Pass format to the QGLWidget and use atomic instead of mutex.
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/bootmanager.cpp13
-rw-r--r--src/citra_qt/bootmanager.hxx5
2 files changed, 5 insertions, 13 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 2407f3a3a..573060d30 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -33,7 +33,7 @@ void EmuThread::SetFilename(std::string filename)
33void EmuThread::run() 33void EmuThread::run()
34{ 34{
35 stop_run = false; 35 stop_run = false;
36 while (true) 36 while (!stop_run)
37 { 37 {
38 for (int tight_loop = 0; tight_loop < 10000; ++tight_loop) 38 for (int tight_loop = 0; tight_loop < 10000; ++tight_loop)
39 { 39 {
@@ -49,9 +49,6 @@ void EmuThread::run()
49 } 49 }
50 } 50 }
51 } 51 }
52 QMutexLocker lock(&mutex);
53 if (stop_run)
54 break;
55 } 52 }
56 render_window->moveContext(); 53 render_window->moveContext();
57 54
@@ -65,11 +62,7 @@ void EmuThread::Stop()
65 INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning..."); 62 INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning...");
66 return; 63 return;
67 } 64 }
68 65 stop_run = true;
69 {
70 QMutexLocker lock(&mutex);
71 stop_run = true;
72 }
73 66
74 //core::g_state = core::SYS_DIE; 67 //core::g_state = core::SYS_DIE;
75 68
@@ -94,7 +87,7 @@ void EmuThread::Stop()
94class GGLWidgetInternal : public QGLWidget 87class GGLWidgetInternal : public QGLWidget
95{ 88{
96public: 89public:
97 GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(parent) 90 GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(fmt, parent)
98 { 91 {
99 parent_ = parent; 92 parent_ = parent;
100 } 93 }
diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx
index 4c3e2f0a4..51cb781e9 100644
--- a/src/citra_qt/bootmanager.hxx
+++ b/src/citra_qt/bootmanager.hxx
@@ -1,6 +1,6 @@
1#include <QMutex>
2#include <QThread> 1#include <QThread>
3#include <QGLWidget> 2#include <QGLWidget>
3#include <atomic>
4#include "common/common.h" 4#include "common/common.h"
5#include "common/emu_window.h" 5#include "common/emu_window.h"
6 6
@@ -67,8 +67,7 @@ private:
67 67
68 bool exec_cpu_step; 68 bool exec_cpu_step;
69 bool cpu_running; 69 bool cpu_running;
70 bool stop_run; 70 std::atomic<bool> stop_run;
71 QMutex mutex;
72 71
73 GRenderWindow* render_window; 72 GRenderWindow* render_window;
74 73