diff options
| author | 2023-02-22 21:30:47 -0500 | |
|---|---|---|
| committer | 2023-03-01 10:42:45 -0500 | |
| commit | 62711fec0275877f56d0448d78096e1403108109 (patch) | |
| tree | 7b95351e997fceb90a89afbb1ea7920ad745477f | |
| parent | kernel: add InfoType::IoRegionHint (diff) | |
| download | yuzu-62711fec0275877f56d0448d78096e1403108109.tar.gz yuzu-62711fec0275877f56d0448d78096e1403108109.tar.xz yuzu-62711fec0275877f56d0448d78096e1403108109.zip | |
kernel: simplify KAbstractSchedulerLock::Lock
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler_lock.h | 11 |
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: | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | if (IsLockedByCurrentThread()) { | 33 | if (IsLockedByCurrentThread()) { |
| 34 | // If we already own the lock, we can just increment the count. | 34 | // If we already own the lock, the lock count should be > 0. |
| 35 | // For debug, ensure this is true. | ||
| 35 | ASSERT(lock_count > 0); | 36 | ASSERT(lock_count > 0); |
| 36 | lock_count++; | ||
| 37 | } else { | 37 | } else { |
| 38 | // Otherwise, we want to disable scheduling and acquire the spinlock. | 38 | // Otherwise, we want to disable scheduling and acquire the spinlock. |
| 39 | SchedulerType::DisableScheduling(kernel); | 39 | SchedulerType::DisableScheduling(kernel); |
| 40 | spin_lock.Lock(); | 40 | spin_lock.Lock(); |
| 41 | 41 | ||
| 42 | // For debug, ensure that our state is valid. | ||
| 43 | ASSERT(lock_count == 0); | 42 | ASSERT(lock_count == 0); |
| 44 | ASSERT(owner_thread == nullptr); | 43 | ASSERT(owner_thread == nullptr); |
| 45 | 44 | ||
| 46 | // Increment count, take ownership. | 45 | // Take ownership of the lock. |
| 47 | lock_count = 1; | ||
| 48 | owner_thread = GetCurrentThreadPointer(kernel); | 46 | owner_thread = GetCurrentThreadPointer(kernel); |
| 49 | } | 47 | } |
| 48 | |||
| 49 | // Increment the lock count. | ||
| 50 | lock_count++; | ||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | void Unlock() { | 53 | void Unlock() { |