mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-29 16:56:05 +00:00
Fix typo and update priority/avoid duplicates on UpdateMutexOwner
This commit is contained in:
parent
ee0b14ba08
commit
fdfa9424c8
|
@ -155,7 +155,7 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
|
|
||||||
if (IdealCore == -2)
|
if (IdealCore == -2)
|
||||||
{
|
{
|
||||||
//TODO: Get this valcdue from the NPDM file.
|
//TODO: Get this value from the NPDM file.
|
||||||
IdealCore = 0;
|
IdealCore = 0;
|
||||||
|
|
||||||
CoreMask = 1 << IdealCore;
|
CoreMask = 1 << IdealCore;
|
||||||
|
|
|
@ -330,6 +330,28 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateMutexOwner(KThread CurrThread, KThread NewOwner, long MutexAddress)
|
||||||
|
{
|
||||||
|
//Go through all threads waiting for the mutex,
|
||||||
|
//and update the MutexOwner field to point to the new owner.
|
||||||
|
lock (Process.ThreadSyncLock)
|
||||||
|
{
|
||||||
|
for (int Index = 0; Index < CurrThread.MutexWaiters.Count; Index++)
|
||||||
|
{
|
||||||
|
KThread Thread = CurrThread.MutexWaiters[Index];
|
||||||
|
|
||||||
|
if (Thread.MutexAddress == MutexAddress)
|
||||||
|
{
|
||||||
|
CurrThread.MutexWaiters.RemoveAt(Index--);
|
||||||
|
|
||||||
|
Thread.MutexOwner = NewOwner;
|
||||||
|
|
||||||
|
InsertWaitingMutexThread(NewOwner, Thread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InsertWaitingMutexThread(int OwnerThreadHandle, KThread WaitThread)
|
private void InsertWaitingMutexThread(int OwnerThreadHandle, KThread WaitThread)
|
||||||
{
|
{
|
||||||
KThread OwnerThread = Process.HandleTable.GetData<KThread>(OwnerThreadHandle);
|
KThread OwnerThread = Process.HandleTable.GetData<KThread>(OwnerThreadHandle);
|
||||||
|
@ -359,28 +381,6 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMutexOwner(KThread CurrThread, KThread NewOwner, long MutexAddress)
|
|
||||||
{
|
|
||||||
//Go through all threads waiting for the mutex,
|
|
||||||
//and update the MutexOwner field to point to the new owner.
|
|
||||||
lock (Process.ThreadSyncLock)
|
|
||||||
{
|
|
||||||
for (int Index = 0; Index < CurrThread.MutexWaiters.Count; Index++)
|
|
||||||
{
|
|
||||||
KThread Thread = CurrThread.MutexWaiters[Index];
|
|
||||||
|
|
||||||
if (Thread.MutexAddress == MutexAddress)
|
|
||||||
{
|
|
||||||
CurrThread.MutexWaiters.RemoveAt(Index--);
|
|
||||||
|
|
||||||
Thread.MutexOwner = NewOwner;
|
|
||||||
|
|
||||||
NewOwner.MutexWaiters.Add(Thread);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private KThread GetHighestPriority(List<KThread> Threads, long MutexAddress)
|
private KThread GetHighestPriority(List<KThread> Threads, long MutexAddress)
|
||||||
{
|
{
|
||||||
return GetHighestPriority(Threads, x => x.MutexAddress == MutexAddress);
|
return GetHighestPriority(Threads, x => x.MutexAddress == MutexAddress);
|
||||||
|
|
Loading…
Reference in a new issue