diff options
| -rw-r--r-- | src/common/threadsafe_queue.h | 10 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index a4647314a..ad04df8ca 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h | |||
| @@ -83,11 +83,15 @@ public: | |||
| 83 | return true; | 83 | return true; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | T PopWait() { | 86 | void Wait() { |
| 87 | if (Empty()) { | 87 | if (Empty()) { |
| 88 | std::unique_lock lock{cv_mutex}; | 88 | std::unique_lock lock{cv_mutex}; |
| 89 | cv.wait(lock, [this]() { return !Empty(); }); | 89 | cv.wait(lock, [this]() { return !Empty(); }); |
| 90 | } | 90 | } |
| 91 | } | ||
| 92 | |||
| 93 | T PopWait() { | ||
| 94 | Wait(); | ||
| 91 | T t; | 95 | T t; |
| 92 | Pop(t); | 96 | Pop(t); |
| 93 | return t; | 97 | return t; |
| @@ -156,6 +160,10 @@ public: | |||
| 156 | return spsc_queue.Pop(t); | 160 | return spsc_queue.Pop(t); |
| 157 | } | 161 | } |
| 158 | 162 | ||
| 163 | void Wait() { | ||
| 164 | spsc_queue.Wait(); | ||
| 165 | } | ||
| 166 | |||
| 159 | T PopWait() { | 167 | T PopWait() { |
| 160 | return spsc_queue.PopWait(); | 168 | return spsc_queue.PopWait(); |
| 161 | } | 169 | } |
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 99353f15f..cd59a7faf 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, | |||
| 29 | system.RegisterHostThread(); | 29 | system.RegisterHostThread(); |
| 30 | 30 | ||
| 31 | // Wait for first GPU command before acquiring the window context | 31 | // Wait for first GPU command before acquiring the window context |
| 32 | while (state.queue.Empty()) | 32 | state.queue.Wait(); |
| 33 | ; | ||
| 34 | 33 | ||
| 35 | // If emulation was stopped during disk shader loading, abort before trying to acquire context | 34 | // If emulation was stopped during disk shader loading, abort before trying to acquire context |
| 36 | if (!state.is_running) { | 35 | if (!state.is_running) { |