From 71e19153ef9309dbcdd9ada95068917f0d0dd44c Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Sat, 2 Oct 2021 00:39:57 -0400 Subject: nvflinger: Use jthread and stop_token for VSync thread Avoids a destruction data race that may occur on the vsync thread --- src/core/hle/service/nvflinger/nvflinger.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/core/hle/service/nvflinger/nvflinger.h') diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 6d84cafb4..7935cf773 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -4,13 +4,10 @@ #pragma once -#include #include #include #include #include -#include -#include #include #include @@ -109,9 +106,7 @@ private: /// Creates a layer with the specified layer ID in the desired display. void CreateLayerAtId(VI::Display& display, u64 layer_id); - static void VSyncThread(NVFlinger& nv_flinger); - - void SplitVSync(); + void SplitVSync(std::stop_token stop_token); std::shared_ptr nvdrv; @@ -133,9 +128,7 @@ private: Core::System& system; - std::unique_ptr vsync_thread; - std::unique_ptr wait_event; - std::atomic is_running{}; + std::jthread vsync_thread; KernelHelpers::ServiceContext service_context; }; -- cgit v1.2.3