summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlat9nq <lat9nq@gmail.com>2022-04-01 18:29:08 -0400
committerlat9nq <lat9nq@gmail.com>2022-04-03 21:47:57 -0400
commit83b86d915ab27be68c8428761c8510817991b5ff (patch)
tree06f9f10fb2d926f163aa0343780cc57c72d20c99
parente9cf2d43f1fb62dd06f9e8ef2e51cb43147ad808 (diff)
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 <bunneidev@gmail.com>
-rw-r--r--src/core/hle/kernel/k_scheduler_lock.h3
1 files changed, 2 insertions, 1 deletions
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 <atomic>
#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<KThread*> owner_thread{};
};
} // namespace Kernel