VERY experimental Nintendo Switch 2 emulator
C++
common/threadsafe_queue: Provide Wait() method.
Markus Wickb529aba9cef9
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.hindex a4647314a7..ad04df8cab 100644--- a/src/common/threadsafe_queue.h+++ b/src/common/threadsafe_queue.h@@ -83,11 +83,15 @@ public:return true;}- T PopWait() {+ void Wait() {if (Empty()) {std::unique_lock lock{cv_mutex};cv.wait(lock, [this]() { return !Empty(); });}+ }++ T PopWait() {+ Wait();T t;Pop(t);return t;@@ -156,6 +160,10 @@ public:return spsc_queue.Pop(t);}+ void Wait() {+ spsc_queue.Wait();+ }+T PopWait() {return spsc_queue.PopWait();}diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cppindex 99353f15f5..cd59a7faf1 100644--- a/src/video_core/gpu_thread.cpp+++ b/src/video_core/gpu_thread.cpp@@ -29,8 +29,7 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,system.RegisterHostThread();// Wait for first GPU command before acquiring the window context- while (state.queue.Empty())- ;+ state.queue.Wait();// If emulation was stopped during disk shader loading, abort before trying to acquire contextif (!state.is_running) {