diff options
| author | 2022-04-01 18:29:08 -0400 | |
|---|---|---|
| committer | 2022-04-03 21:47:57 -0400 | |
| commit | 83b86d915ab27be68c8428761c8510817991b5ff (patch) | |
| tree | 06f9f10fb2d926f163aa0343780cc57c72d20c99 /src | |
| parent | Merge pull request #8105 from merryhime/atomicload128 (diff) | |
| download | yuzu-83b86d915ab27be68c8428761c8510817991b5ff.tar.gz yuzu-83b86d915ab27be68c8428761c8510817991b5ff.tar.xz yuzu-83b86d915ab27be68c8428761c8510817991b5ff.zip | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler_lock.h | 3 |
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 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | ||
| 7 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| 8 | #include "core/hle/kernel/k_spin_lock.h" | 9 | #include "core/hle/kernel/k_spin_lock.h" |
| 9 | #include "core/hle/kernel/k_thread.h" | 10 | #include "core/hle/kernel/k_thread.h" |
| @@ -75,7 +76,7 @@ private: | |||
| 75 | KernelCore& kernel; | 76 | KernelCore& kernel; |
| 76 | KAlignedSpinLock spin_lock{}; | 77 | KAlignedSpinLock spin_lock{}; |
| 77 | s32 lock_count{}; | 78 | s32 lock_count{}; |
| 78 | KThread* owner_thread{}; | 79 | std::atomic<KThread*> owner_thread{}; |
| 79 | }; | 80 | }; |
| 80 | 81 | ||
| 81 | } // namespace Kernel | 82 | } // namespace Kernel |