From 6bcbbb29e7822f5ebd6ac985066dfdd0890492f0 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Fri, 1 Apr 2022 18:57:40 -0400 Subject: k_thread: Fix data race TSan reports a data race between writing at cpp:1162 and reading at h:262. Make the thread_state atomic to prevent this. --- src/core/hle/kernel/k_thread.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/hle/kernel/k_thread.h') diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index f46db7298..d0fd85130 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include #include @@ -751,7 +752,7 @@ private: KAffinityMask original_physical_affinity_mask{}; s32 original_physical_ideal_core_id{}; s32 num_core_migration_disables{}; - ThreadState thread_state{}; + std::atomic thread_state{}; std::atomic termination_requested{}; bool wait_cancelled{}; bool cancellable{}; -- cgit v1.2.3