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>
This commit is contained in:
lat9nq 2022-04-01 18:29:08 -04:00
parent e9cf2d43f1
commit 83b86d915a

View File

@ -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