From 877cd60b00a3f827062fdaff93183b52174ec134 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Wed, 15 Sep 2021 20:32:54 -0400 Subject: gpu: Use std::jthread for async gpu thread --- src/video_core/gpu_thread.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/video_core/gpu_thread.h') diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h index 11a648f38..91bada925 100644 --- a/src/video_core/gpu_thread.h +++ b/src/video_core/gpu_thread.h @@ -33,9 +33,6 @@ class RendererBase; namespace VideoCommon::GPUThread { -/// Command to signal to the GPU thread that processing has ended -struct EndProcessingCommand final {}; - /// Command to signal to the GPU thread that a command list is ready for processing struct SubmitListCommand final { explicit SubmitListCommand(Tegra::CommandList&& entries_) : entries{std::move(entries_)} {} @@ -83,7 +80,7 @@ struct OnCommandListEndCommand final {}; struct GPUTickCommand final {}; using CommandData = - std::variant; @@ -100,14 +97,12 @@ struct CommandDataContainer { /// Struct used to synchronize the GPU thread struct SynchState final { - std::atomic_bool is_running{true}; - - using CommandQueue = Common::SPSCQueue; + using CommandQueue = Common::SPSCQueue; std::mutex write_lock; CommandQueue queue; u64 last_fence{}; std::atomic signaled_fence{}; - std::condition_variable cv; + std::condition_variable_any cv; }; /// Class used to manage the GPU thread @@ -149,7 +144,7 @@ private: VideoCore::RasterizerInterface* rasterizer = nullptr; SynchState state; - std::thread thread; + std::jthread thread; }; } // namespace VideoCommon::GPUThread -- cgit v1.2.3