Use mutex for synchronizing the UI with the emulator thread

This commit is contained in:
wheremyfoodat 2023-10-07 22:10:10 +03:00
parent ab2ff18290
commit 6ae8d084b4
2 changed files with 41 additions and 14 deletions

View file

@ -6,8 +6,9 @@
#include <QPalette>
#include <QtWidgets>
#include <atomic>
#include <thread>
#include <filesystem>
#include <thread>
#include <mutex>
#include "emulator.hpp"
#include "panda_qt/screen.hpp"
@ -27,9 +28,11 @@ class MainWindow : public QMainWindow {
std::thread emuThread;
std::atomic<bool> appRunning = true; // Is the application itself running?
std::atomic<bool> needToLoadROM = false;
std::mutex messageQueueMutex; // Used for synchronizing messages between the emulator and UI
std::filesystem::path romToLoad = "";
bool needToLoadROM = false;
ScreenWidget screen;
QComboBox* themeSelect = nullptr;
QMenuBar* menuBar = nullptr;