mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-14 23:24:26 -04:00
kern: fix use of plr vs plr_heap, fix close/unlock order in ArbitrateLock
This commit is contained in:
parent
52c914afcc
commit
42b6c2dd95
4 changed files with 21 additions and 15 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue