forked from Mirror/Ryujinx
Fix a thread sync bug as is the usual...
This commit is contained in:
parent
aa75957ce2
commit
adeb8793c2
1 changed files with 10 additions and 4 deletions
|
@ -254,7 +254,7 @@ namespace Ryujinx.Core.OsHle.Kernel
|
|||
WaitThread.MutexAddress = MutexAddress;
|
||||
WaitThread.CondVarAddress = CondVarAddress;
|
||||
|
||||
lock (Process.ThreadArbiterList)
|
||||
lock (Process.ThreadSyncLock)
|
||||
{
|
||||
WaitThread.CondVarSignaled = false;
|
||||
|
||||
|
@ -267,12 +267,18 @@ namespace Ryujinx.Core.OsHle.Kernel
|
|||
{
|
||||
Process.Scheduler.EnterWait(WaitThread, NsTimeConverter.GetTimeMs(Timeout));
|
||||
|
||||
lock (Process.ThreadArbiterList)
|
||||
lock (Process.ThreadSyncLock)
|
||||
{
|
||||
if (!WaitThread.CondVarSignaled)
|
||||
WaitThread.MutexOwner?.MutexWaiters.Remove(WaitThread);
|
||||
|
||||
if (!WaitThread.CondVarSignaled || WaitThread.MutexOwner != null)
|
||||
{
|
||||
WaitThread.MutexOwner = null;
|
||||
|
||||
Process.ThreadArbiterList.Remove(WaitThread);
|
||||
|
||||
Ns.Log.PrintDebug(LogClass.KernelSvc, "Timed out...");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +293,7 @@ namespace Ryujinx.Core.OsHle.Kernel
|
|||
|
||||
private void CondVarSignal(KThread CurrThread, long CondVarAddress, int Count)
|
||||
{
|
||||
lock (Process.ThreadArbiterList)
|
||||
lock (Process.ThreadSyncLock)
|
||||
{
|
||||
while (Count == -1 || Count-- > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue