mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-15 10:36:58 +00:00
Memory changes 2.2 (ryubing/ryujinx!143)
See merge request ryubing/ryujinx!143
This commit is contained in:
parent
4c9b48b754
commit
a60b2a0ba3
14 changed files with 242 additions and 239 deletions
|
|
@ -39,9 +39,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
public const int MaxWaitSyncObjects = 64;
|
||||
|
||||
private ManualResetEvent _schedulerWaitEvent;
|
||||
private ManualResetEventSlim _schedulerWaitEvent;
|
||||
|
||||
public ManualResetEvent SchedulerWaitEvent => _schedulerWaitEvent;
|
||||
public ManualResetEventSlim SchedulerWaitEvent => _schedulerWaitEvent;
|
||||
|
||||
public Thread HostThread { get; private set; }
|
||||
|
||||
|
|
@ -93,6 +93,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
private LinkedListNode<KThread> _mutexWaiterNode;
|
||||
|
||||
private readonly LinkedList<KThread> _pinnedWaiters;
|
||||
private LinkedListNode<KThread> _pinnedWaiterNode;
|
||||
|
||||
public KThread MutexOwner { get; private set; }
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
private readonly Lock _activityOperationLock = new();
|
||||
|
||||
internal readonly ManualResetEvent DebugHalt = new(false);
|
||||
internal readonly ManualResetEventSlim DebugHalt = new(false);
|
||||
|
||||
public KThread(KernelContext context) : base(context)
|
||||
{
|
||||
|
|
@ -144,8 +145,18 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
SiblingsPerCore = new LinkedListNode<KThread>[KScheduler.CpuCoresCount];
|
||||
|
||||
for (int i = 0; i < SiblingsPerCore.Length; i++)
|
||||
{
|
||||
SiblingsPerCore[i] = new LinkedListNode<KThread>(this);
|
||||
}
|
||||
|
||||
_mutexWaiters = [];
|
||||
_pinnedWaiters = [];
|
||||
|
||||
WithholderNode = new LinkedListNode<KThread>(this);
|
||||
ProcessListNode = new LinkedListNode<KThread>(this);
|
||||
_mutexWaiterNode = new LinkedListNode<KThread>(this);
|
||||
_pinnedWaiterNode = new LinkedListNode<KThread>(this);
|
||||
}
|
||||
|
||||
public Result Initialize(
|
||||
|
|
@ -631,7 +642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
break;
|
||||
}
|
||||
|
||||
_pinnedWaiters.AddLast(currentThread);
|
||||
_pinnedWaiters.AddLast(_pinnedWaiterNode);
|
||||
|
||||
currentThread.Reschedule(ThreadSchedState.Paused);
|
||||
}
|
||||
|
|
@ -848,7 +859,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
return KernelResult.ThreadTerminating;
|
||||
}
|
||||
|
||||
_pinnedWaiters.AddLast(currentThread);
|
||||
_pinnedWaiters.AddLast(_pinnedWaiterNode);
|
||||
|
||||
currentThread.Reschedule(ThreadSchedState.Paused);
|
||||
}
|
||||
|
|
@ -1262,7 +1273,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
{
|
||||
if (_schedulerWaitEvent == null)
|
||||
{
|
||||
ManualResetEvent schedulerWaitEvent = new(false);
|
||||
ManualResetEventSlim schedulerWaitEvent = new(false);
|
||||
|
||||
if (Interlocked.Exchange(ref _schedulerWaitEvent, schedulerWaitEvent) == null)
|
||||
{
|
||||
|
|
@ -1277,7 +1288,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
private void ThreadStart()
|
||||
{
|
||||
_schedulerWaitEvent.WaitOne();
|
||||
_schedulerWaitEvent.Wait();
|
||||
DebugHalt.Reset();
|
||||
KernelStatic.SetKernelContext(KernelContext, this);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue