summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_light_lock.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-21 22:00:16 +0100
committerbunnei <bunneidev@gmail.com>2021-01-29 06:42:26 +0100
commit6e953f7f0294d945ba9d6f08350d5dccb0d76075 (patch)
tree92a498827c4de7dd372731eff83c66aa3f57f060 /src/core/hle/kernel/k_light_lock.cpp
parenthle: kernel: k_scheduler: Use atomics for current_thread, etc. (diff)
downloadyuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar.gz
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar.bz2
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar.lz
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar.xz
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.tar.zst
yuzu-6e953f7f0294d945ba9d6f08350d5dccb0d76075.zip
Diffstat (limited to 'src/core/hle/kernel/k_light_lock.cpp')
-rw-r--r--src/core/hle/kernel/k_light_lock.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/core/hle/kernel/k_light_lock.cpp b/src/core/hle/kernel/k_light_lock.cpp
index 1d54ba5df..08fa65fd5 100644
--- a/src/core/hle/kernel/k_light_lock.cpp
+++ b/src/core/hle/kernel/k_light_lock.cpp
@@ -9,12 +9,6 @@
namespace Kernel {
-static KThread* ToThread(uintptr_t thread_) {
- ASSERT((thread_ & EmuThreadHandleReserved) == 0);
- ASSERT((thread_ & 1) == 0);
- return reinterpret_cast<KThread*>(thread_);
-}
-
void KLightLock::Lock() {
const uintptr_t cur_thread = reinterpret_cast<uintptr_t>(GetCurrentThreadPointer(kernel));
const uintptr_t cur_thread_tag = (cur_thread | 1);
@@ -48,7 +42,7 @@ void KLightLock::Unlock() {
}
void KLightLock::LockSlowPath(uintptr_t _owner, uintptr_t _cur_thread) {
- KThread* cur_thread = ToThread(_cur_thread);
+ KThread* cur_thread = reinterpret_cast<KThread*>(_cur_thread);
// Pend the current thread waiting on the owner thread.
{
@@ -60,7 +54,7 @@ void KLightLock::LockSlowPath(uintptr_t _owner, uintptr_t _cur_thread) {
}
// Add the current thread as a waiter on the owner.
- KThread* owner_thread = ToThread(_owner & ~1ul);
+ KThread* owner_thread = reinterpret_cast<KThread*>(_owner & ~1ul);
cur_thread->SetAddressKey(reinterpret_cast<uintptr_t>(std::addressof(tag)));
owner_thread->AddWaiter(cur_thread);
@@ -88,7 +82,7 @@ void KLightLock::LockSlowPath(uintptr_t _owner, uintptr_t _cur_thread) {
}
void KLightLock::UnlockSlowPath(uintptr_t _cur_thread) {
- KThread* owner_thread = ToThread(_cur_thread);
+ KThread* owner_thread = reinterpret_cast<KThread*>(_cur_thread);
// Unlock.
{