From efbae02a227ef20d99c4bee2c63b3a57be91f4f0 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 11 Jul 2019 16:22:51 +0300 Subject: [PATCH] Fix Emu.Stop() with vulkan device enumeration hack --- rpcs3/rpcs3qt/emu_settings.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 1ccce4b455..5c2241fd39 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -166,11 +166,11 @@ emu_settings::Render_Creator::Render_Creator() static std::mutex mtx; static std::condition_variable cond; static bool thread_running = true; - static volatile bool device_found = false; + static bool device_found = false; static QStringList compatible_gpus; - thread_ctrl::spawn("Vulkan device enumeration", [&] + std::thread enum_thread = std::thread([&] { thread_ctrl::set_native_priority(-1); @@ -192,6 +192,7 @@ emu_settings::Render_Creator::Render_Creator() } } } + std::scoped_lock{mtx}, thread_running = false; cond.notify_all(); }); @@ -210,6 +211,7 @@ emu_settings::Render_Creator::Render_Creator() "Selecting ignore starts the emulator without Vulkan support."), QMessageBox::Ignore | QMessageBox::Abort, QMessageBox::Abort); + enum_thread.detach(); if (button != QMessageBox::Ignore) std::exit(1); @@ -219,6 +221,7 @@ emu_settings::Render_Creator::Render_Creator() { supportsVulkan = device_found; vulkanAdapters = std::move(compatible_gpus); + enum_thread.join(); } #endif