mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 16:15:47 +00:00
99b2692425
* Call interrupt less often, remove some leftovers from the old scheduler code * Remove unneeded attribute
65 lines
No EOL
1.5 KiB
C#
65 lines
No EOL
1.5 KiB
C#
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Kernel
|
|
{
|
|
class KCoreContext
|
|
{
|
|
private KScheduler Scheduler;
|
|
|
|
private HleCoreManager CoreManager;
|
|
|
|
public bool ContextSwitchNeeded { get; private set; }
|
|
|
|
public KThread CurrentThread { get; private set; }
|
|
public KThread SelectedThread { get; private set; }
|
|
|
|
public KCoreContext(KScheduler Scheduler, HleCoreManager CoreManager)
|
|
{
|
|
this.Scheduler = Scheduler;
|
|
this.CoreManager = CoreManager;
|
|
}
|
|
|
|
public void SelectThread(KThread Thread)
|
|
{
|
|
SelectedThread = Thread;
|
|
|
|
if (Thread != null)
|
|
{
|
|
Thread.LastScheduledTicks = (uint)Environment.TickCount;
|
|
}
|
|
|
|
if (SelectedThread != CurrentThread)
|
|
{
|
|
ContextSwitchNeeded = true;
|
|
}
|
|
}
|
|
|
|
public void UpdateCurrentThread()
|
|
{
|
|
ContextSwitchNeeded = false;
|
|
|
|
CurrentThread = SelectedThread;
|
|
}
|
|
|
|
public void ContextSwitch()
|
|
{
|
|
ContextSwitchNeeded = false;
|
|
|
|
if (CurrentThread != null)
|
|
{
|
|
CoreManager.GetThread(CurrentThread.Context.Work).Reset();
|
|
}
|
|
|
|
CurrentThread = SelectedThread;
|
|
|
|
if (CurrentThread != null)
|
|
{
|
|
CurrentThread.ClearExclusive();
|
|
|
|
CoreManager.GetThread(CurrentThread.Context.Work).Set();
|
|
|
|
CurrentThread.Context.Execute();
|
|
}
|
|
}
|
|
}
|
|
} |