Merge pull request #3794 from EmptyChaos/frame-advance-race

Core: Add synchronization to state changes (Fix Frame Step and FIFO Player -  Issue 8718)
This commit is contained in:
Mat M
2016-05-22 15:19:16 -04:00
36 changed files with 992 additions and 415 deletions

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QAbstractEventDispatcher>
#include <QApplication>
#include <QMutexLocker>
#include "Common/Common.h"
@ -57,7 +59,15 @@ void Host::SetRenderFullscreen(bool fullscreen)
void Host_Message(int id)
{
if (id == WM_USER_STOP)
{
emit Host::GetInstance()->RequestStop();
}
else if (id == WM_USER_JOB_DISPATCH)
{
// Just poke the main thread to get it to wake up, job dispatch
// will happen automatically before it goes back to sleep again.
QAbstractEventDispatcher::instance(qApp->thread())->wakeUp();
}
}
void Host_UpdateTitle(const std::string& title)

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QAbstractEventDispatcher>
#include <QApplication>
#include "Core/BootManager.h"
@ -20,6 +21,12 @@ int main(int argc, char* argv[])
UICommon::Init();
Resources::Init();
// Whenever the event loop is about to go to sleep, dispatch the jobs
// queued in the Core first.
QObject::connect(QAbstractEventDispatcher::instance(),
&QAbstractEventDispatcher::aboutToBlock,
&app, &Core::HostDispatchJobs);
MainWindow win;
win.show();
int retval = app.exec();