From 83b86d915ab27be68c8428761c8510817991b5ff Mon Sep 17 00:00:00 2001 From: lat9nq Date: Fri, 1 Apr 2022 18:29:08 -0400 Subject: k_scheduler_lock: Fix data race TSan reports a race between the main thread and T37 during IsLockedByCurrentThread and when it's set at the end of Lock(), respectively. Set owner_thread to an atomic pointer to fix it. Co-authored-by: bunnei --- src/core/hle/kernel/k_scheduler_lock.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/k_scheduler_lock.h b/src/core/hle/kernel/k_scheduler_lock.h index 93c47f1b1..016e0a818 100644 --- a/src/core/hle/kernel/k_scheduler_lock.h +++ b/src/core/hle/kernel/k_scheduler_lock.h @@ -4,6 +4,7 @@ #pragma once +#include #include "common/assert.h" #include "core/hle/kernel/k_spin_lock.h" #include "core/hle/kernel/k_thread.h" @@ -75,7 +76,7 @@ private: KernelCore& kernel; KAlignedSpinLock spin_lock{}; s32 lock_count{}; - KThread* owner_thread{}; + std::atomic owner_thread{}; }; } // namespace Kernel -- cgit v1.2.3