[HLE/Kernel] Fix SetThreadPriority, allow nano seconds values > int.MaxValue, fix on WaitProcessWideKeyAtomic (althrough looks like it still doesn't work properly

This commit is contained in:
gdkchan 2018-04-19 04:06:23 -03:00
parent 62b2124c03
commit 33ae6e544b
6 changed files with 47 additions and 24 deletions

View file

@ -22,7 +22,7 @@ namespace Ryujinx.Core.OsHle.Kernel
WaitingThreads = new List<(KThread, AutoResetEvent)>();
}
public bool WaitForSignal(KThread Thread, long Timeout)
public bool WaitForSignal(KThread Thread, ulong Timeout)
{
bool Result = true;
@ -37,23 +37,19 @@ namespace Ryujinx.Core.OsHle.Kernel
WaitingThreads.Add((Thread, WaitEvent));
}
Process.Scheduler.Suspend(Thread.ProcessorId);
if (Timeout < 0)
if (Timeout == ulong.MaxValue)
{
Result = WaitEvent.WaitOne();
}
else
{
Result = WaitEvent.WaitOne((int)(Timeout / 1000000));
Result = WaitEvent.WaitOne(NsTimeConverter.GetTimeMs(Timeout));
lock (WaitingThreads)
{
WaitingThreads.Remove((Thread, WaitEvent));
}
}
Process.Scheduler.Resume(Thread);
}
}