mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 01:26:34 +00:00
kern: simplify KSchedulerLock::Lock
This commit is contained in:
parent
88520f8b6a
commit
b484f27530
1 changed files with 6 additions and 4 deletions
|
@ -49,9 +49,9 @@ namespace ams::kern {
|
||||||
MESOSPHERE_ASSERT_THIS();
|
MESOSPHERE_ASSERT_THIS();
|
||||||
|
|
||||||
if (this->IsLockedByCurrentThread()) {
|
if (this->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. */
|
||||||
MESOSPHERE_ASSERT(m_lock_count > 0);
|
MESOSPHERE_ASSERT(m_lock_count > 0);
|
||||||
m_lock_count++;
|
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise, we want to disable scheduling and acquire the spinlock. */
|
/* Otherwise, we want to disable scheduling and acquire the spinlock. */
|
||||||
SchedulerType::DisableScheduling();
|
SchedulerType::DisableScheduling();
|
||||||
|
@ -61,10 +61,12 @@ namespace ams::kern {
|
||||||
MESOSPHERE_ASSERT(m_lock_count == 0);
|
MESOSPHERE_ASSERT(m_lock_count == 0);
|
||||||
MESOSPHERE_ASSERT(m_owner_thread == nullptr);
|
MESOSPHERE_ASSERT(m_owner_thread == nullptr);
|
||||||
|
|
||||||
/* Increment count, take ownership. */
|
/* Take ownership of the lock. */
|
||||||
m_lock_count = 1;
|
|
||||||
m_owner_thread = GetCurrentThreadPointer();
|
m_owner_thread = GetCurrentThreadPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Increment the lock count. */
|
||||||
|
m_lock_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
MESOSPHERE_ALWAYS_INLINE_IF_RELEASE void Unlock() {
|
MESOSPHERE_ALWAYS_INLINE_IF_RELEASE void Unlock() {
|
||||||
|
|
Loading…
Reference in a new issue