summaryrefslogtreecommitdiff
path: root/src/video_core/gpu_thread.cpp
diff options
context:
space:
mode:
authorGravatar Morph2023-03-19 14:24:18 -0400
committerGravatar Morph2023-03-21 19:20:21 -0400
commit407dc917f170cc9d08f3f1f9bdeb9e44ddebc653 (patch)
tree6275a084c767fd96e4d9ccbedc117d3fb43b7e68 /src/video_core/gpu_thread.cpp
parentbounded_threadsafe_queue: Add TryPush (diff)
downloadyuzu-407dc917f170cc9d08f3f1f9bdeb9e44ddebc653.tar.gz
yuzu-407dc917f170cc9d08f3f1f9bdeb9e44ddebc653.tar.xz
yuzu-407dc917f170cc9d08f3f1f9bdeb9e44ddebc653.zip
bounded_threadsafe_queue: Deduplicate and add PushModes
Adds the PushModes Try and Wait to allow producers to specify how they want to push their data to the queue if the queue is full. If the queue is full: - Try will fail to push to the queue, returning false. Try only returns true if it successfully pushes to the queue. This may result in items not being pushed into the queue. - Wait will wait until a slot is available to push to the queue, resulting in potential for deadlock if a consumer is not running.
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
-rw-r--r--src/video_core/gpu_thread.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 469a59cf9..3c5317777 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -118,7 +118,7 @@ u64 ThreadManager::PushCommand(CommandData&& command_data, bool block) {
118 118
119 std::unique_lock lk(state.write_lock); 119 std::unique_lock lk(state.write_lock);
120 const u64 fence{++state.last_fence}; 120 const u64 fence{++state.last_fence};
121 state.queue.Push(std::move(command_data), fence, block); 121 state.queue.EmplaceWait(std::move(command_data), fence, block);
122 122
123 if (block) { 123 if (block) {
124 Common::CondvarWait(state.cv, lk, thread.get_stop_token(), [this, fence] { 124 Common::CondvarWait(state.cv, lk, thread.get_stop_token(), [this, fence] {