summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-02-23 03:30:47 +0100
committerLiam <byteslice@airmail.cc>2023-03-01 16:42:45 +0100
commit62711fec0275877f56d0448d78096e1403108109 (patch)
tree7b95351e997fceb90a89afbb1ea7920ad745477f
parentkernel: add InfoType::IoRegionHint (diff)
downloadyuzu-62711fec0275877f56d0448d78096e1403108109.tar
yuzu-62711fec0275877f56d0448d78096e1403108109.tar.gz
yuzu-62711fec0275877f56d0448d78096e1403108109.tar.bz2
yuzu-62711fec0275877f56d0448d78096e1403108109.tar.lz
yuzu-62711fec0275877f56d0448d78096e1403108109.tar.xz
yuzu-62711fec0275877f56d0448d78096e1403108109.tar.zst
yuzu-62711fec0275877f56d0448d78096e1403108109.zip
-rw-r--r--src/core/hle/kernel/k_scheduler_lock.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/kernel/k_scheduler_lock.h b/src/core/hle/kernel/k_scheduler_lock.h
index 129d60472..13463717f 100644
--- a/src/core/hle/kernel/k_scheduler_lock.h
+++ b/src/core/hle/kernel/k_scheduler_lock.h
@@ -31,22 +31,23 @@ public:
}
if (IsLockedByCurrentThread()) {
- // If we already own the lock, we can just increment the count.
+ // If we already own the lock, the lock count should be > 0.
+ // For debug, ensure this is true.
ASSERT(lock_count > 0);
- lock_count++;
} else {
// Otherwise, we want to disable scheduling and acquire the spinlock.
SchedulerType::DisableScheduling(kernel);
spin_lock.Lock();
- // For debug, ensure that our state is valid.
ASSERT(lock_count == 0);
ASSERT(owner_thread == nullptr);
- // Increment count, take ownership.
- lock_count = 1;
+ // Take ownership of the lock.
owner_thread = GetCurrentThreadPointer(kernel);
}
+
+ // Increment the lock count.
+ lock_count++;
}
void Unlock() {