mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 14:05:13 +01:00
Pass format to the QGLWidget and use atomic instead of mutex.
This commit is contained in:
parent
b044510fa9
commit
1b1205cf73
@ -33,7 +33,7 @@ void EmuThread::SetFilename(std::string filename)
|
|||||||
void EmuThread::run()
|
void EmuThread::run()
|
||||||
{
|
{
|
||||||
stop_run = false;
|
stop_run = false;
|
||||||
while (true)
|
while (!stop_run)
|
||||||
{
|
{
|
||||||
for (int tight_loop = 0; tight_loop < 10000; ++tight_loop)
|
for (int tight_loop = 0; tight_loop < 10000; ++tight_loop)
|
||||||
{
|
{
|
||||||
@ -49,9 +49,6 @@ void EmuThread::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QMutexLocker lock(&mutex);
|
|
||||||
if (stop_run)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
render_window->moveContext();
|
render_window->moveContext();
|
||||||
|
|
||||||
@ -65,11 +62,7 @@ void EmuThread::Stop()
|
|||||||
INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning...");
|
INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
QMutexLocker lock(&mutex);
|
|
||||||
stop_run = true;
|
stop_run = true;
|
||||||
}
|
|
||||||
|
|
||||||
//core::g_state = core::SYS_DIE;
|
//core::g_state = core::SYS_DIE;
|
||||||
|
|
||||||
@ -94,7 +87,7 @@ void EmuThread::Stop()
|
|||||||
class GGLWidgetInternal : public QGLWidget
|
class GGLWidgetInternal : public QGLWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(parent)
|
GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(fmt, parent)
|
||||||
{
|
{
|
||||||
parent_ = parent;
|
parent_ = parent;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <QMutex>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
#include <atomic>
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/emu_window.h"
|
#include "common/emu_window.h"
|
||||||
|
|
||||||
@ -67,8 +67,7 @@ private:
|
|||||||
|
|
||||||
bool exec_cpu_step;
|
bool exec_cpu_step;
|
||||||
bool cpu_running;
|
bool cpu_running;
|
||||||
bool stop_run;
|
std::atomic<bool> stop_run;
|
||||||
QMutex mutex;
|
|
||||||
|
|
||||||
GRenderWindow* render_window;
|
GRenderWindow* render_window;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user