aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/HleScheduler.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-12-06 05:16:24 -0600
committergdkchan <gab.dark.100@gmail.com>2018-12-06 09:16:24 -0200
commitfb1d9493a3d43f2b86c551682586905a1f0e9ea7 (patch)
treed842685ff5bdd45d11d94bd1a45a002b9d532fe7 /Ryujinx.HLE/HOS/Kernel/HleScheduler.cs
parent3615a70cae3f89197fe185dfc5d0a47fa42151d9 (diff)
Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Apply previous refactorings to the merged code
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/HleScheduler.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/HleScheduler.cs74
1 files changed, 37 insertions, 37 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/HleScheduler.cs b/Ryujinx.HLE/HOS/Kernel/HleScheduler.cs
index 87dbe553..1a4c9dfe 100644
--- a/Ryujinx.HLE/HOS/Kernel/HleScheduler.cs
+++ b/Ryujinx.HLE/HOS/Kernel/HleScheduler.cs
@@ -7,21 +7,21 @@ namespace Ryujinx.HLE.HOS.Kernel
{
private const int RoundRobinTimeQuantumMs = 10;
- private int CurrentCore;
+ private int _currentCore;
public bool MultiCoreScheduling { get; set; }
public HleCoreManager CoreManager { get; private set; }
- private bool KeepPreempting;
+ private bool _keepPreempting;
public void StartAutoPreemptionThread()
{
- Thread PreemptionThread = new Thread(PreemptCurrentThread);
+ Thread preemptionThread = new Thread(PreemptCurrentThread);
- KeepPreempting = true;
+ _keepPreempting = true;
- PreemptionThread.Start();
+ preemptionThread.Start();
}
public void ContextSwitch()
@@ -30,28 +30,28 @@ namespace Ryujinx.HLE.HOS.Kernel
{
if (MultiCoreScheduling)
{
- int SelectedCount = 0;
+ int selectedCount = 0;
- for (int Core = 0; Core < KScheduler.CpuCoresCount; Core++)
+ for (int core = 0; core < CpuCoresCount; core++)
{
- KCoreContext CoreContext = CoreContexts[Core];
+ KCoreContext coreContext = CoreContexts[core];
- if (CoreContext.ContextSwitchNeeded && (CoreContext.CurrentThread?.Context.IsCurrentThread() ?? false))
+ if (coreContext.ContextSwitchNeeded && (coreContext.CurrentThread?.Context.IsCurrentThread() ?? false))
{
- CoreContext.ContextSwitch();
+ coreContext.ContextSwitch();
}
- if (CoreContext.CurrentThread?.Context.IsCurrentThread() ?? false)
+ if (coreContext.CurrentThread?.Context.IsCurrentThread() ?? false)
{
- SelectedCount++;
+ selectedCount++;
}
}
- if (SelectedCount == 0)
+ if (selectedCount == 0)
{
CoreManager.Reset(Thread.CurrentThread);
}
- else if (SelectedCount == 1)
+ else if (selectedCount == 1)
{
CoreManager.Set(Thread.CurrentThread);
}
@@ -62,41 +62,41 @@ namespace Ryujinx.HLE.HOS.Kernel
}
else
{
- KThread CurrentThread = CoreContexts[CurrentCore].CurrentThread;
+ KThread currentThread = CoreContexts[_currentCore].CurrentThread;
- bool HasThreadExecuting = CurrentThread != null;
+ bool hasThreadExecuting = currentThread != null;
- if (HasThreadExecuting)
+ if (hasThreadExecuting)
{
//If this is not the thread that is currently executing, we need
//to request an interrupt to allow safely starting another thread.
- if (!CurrentThread.Context.IsCurrentThread())
+ if (!currentThread.Context.IsCurrentThread())
{
- CurrentThread.Context.RequestInterrupt();
+ currentThread.Context.RequestInterrupt();
return;
}
- CoreManager.Reset(CurrentThread.Context.Work);
+ CoreManager.Reset(currentThread.Context.Work);
}
//Advance current core and try picking a thread,
//keep advancing if it is null.
- for (int Core = 0; Core < 4; Core++)
+ for (int core = 0; core < 4; core++)
{
- CurrentCore = (CurrentCore + 1) % CpuCoresCount;
+ _currentCore = (_currentCore + 1) % CpuCoresCount;
- KCoreContext CoreContext = CoreContexts[CurrentCore];
+ KCoreContext coreContext = CoreContexts[_currentCore];
- CoreContext.UpdateCurrentThread();
+ coreContext.UpdateCurrentThread();
- if (CoreContext.CurrentThread != null)
+ if (coreContext.CurrentThread != null)
{
- CoreContext.CurrentThread.ClearExclusive();
+ coreContext.CurrentThread.ClearExclusive();
- CoreManager.Set(CoreContext.CurrentThread.Context.Work);
+ CoreManager.Set(coreContext.CurrentThread.Context.Work);
- CoreContext.CurrentThread.Context.Execute();
+ coreContext.CurrentThread.Context.Execute();
break;
}
@@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Kernel
//If nothing was running before, then we are on a "external"
//HLE thread, we don't need to wait.
- if (!HasThreadExecuting)
+ if (!hasThreadExecuting)
{
return;
}
@@ -119,13 +119,13 @@ namespace Ryujinx.HLE.HOS.Kernel
//Preempts current thread every 10 milliseconds on a round-robin fashion,
//when multi core scheduling is disabled, to try ensuring that all threads
//gets a chance to run.
- while (KeepPreempting)
+ while (_keepPreempting)
{
lock (CoreContexts)
{
- KThread CurrentThread = CoreContexts[CurrentCore].CurrentThread;
+ KThread currentThread = CoreContexts[_currentCore].CurrentThread;
- CurrentThread?.Context.RequestInterrupt();
+ currentThread?.Context.RequestInterrupt();
}
PreemptThreads();
@@ -134,16 +134,16 @@ namespace Ryujinx.HLE.HOS.Kernel
}
}
- public void ExitThread(KThread Thread)
+ public void ExitThread(KThread thread)
{
- Thread.Context.StopExecution();
+ thread.Context.StopExecution();
- CoreManager.Exit(Thread.Context.Work);
+ CoreManager.Exit(thread.Context.Work);
}
- public void RemoveThread(KThread Thread)
+ public void RemoveThread(KThread thread)
{
- CoreManager.RemoveThread(Thread.Context.Work);
+ CoreManager.RemoveThread(thread.Context.Work);
}
}
} \ No newline at end of file