kern: fix use of plr vs plr_heap, fix close/unlock order in ArbitrateLock
This commit is contained in:
@@ -113,6 +113,7 @@ namespace ams::kern {
|
||||
ThreadQueueImplForKConditionVariableWaitForAddress wait_queue;
|
||||
|
||||
/* Wait for the address. */
|
||||
KThread *owner_thread;
|
||||
{
|
||||
KScopedSchedulerLock sl;
|
||||
|
||||
@@ -127,8 +128,8 @@ namespace ams::kern {
|
||||
R_SUCCEED_IF(test_tag != (handle | ams::svc::HandleWaitMask));
|
||||
|
||||
/* Get the lock owner thread. */
|
||||
KScopedAutoObject owner_thread = GetCurrentProcess().GetHandleTable().GetObjectWithoutPseudoHandle<KThread>(handle);
|
||||
R_UNLESS(owner_thread.IsNotNull(), svc::ResultInvalidHandle());
|
||||
owner_thread = GetCurrentProcess().GetHandleTable().GetObjectWithoutPseudoHandle<KThread>(handle).ReleasePointerUnsafe();
|
||||
R_UNLESS(owner_thread != nullptr, svc::ResultInvalidHandle());
|
||||
|
||||
/* Update the lock. */
|
||||
cur_thread->SetAddressKey(addr, value);
|
||||
@@ -138,6 +139,9 @@ namespace ams::kern {
|
||||
cur_thread->BeginWait(std::addressof(wait_queue));
|
||||
}
|
||||
|
||||
/* Close our reference to the owner thread, now that the wait is over. */
|
||||
owner_thread->Close();
|
||||
|
||||
/* Get the wait result. */
|
||||
return cur_thread->GetWaitResult();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user