diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-05-04 00:41:29 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 13:41:29 +1000 |
commit | 15d1cc806b1b978bab83d8bb426a124d9f0f788c (patch) | |
tree | 4fd10fdd11412bafcf3022e7cc4eb21179eef1b1 /Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs | |
parent | cd48576f5846aa89a36bfc833e9de5dde9627aed (diff) |
Move kernel state out of the Horizon class (#1107)
* Move kernel state from Horizon to KernelContext
* Merge syscalls partial classes, split 32 and 64-bit variants
* Sort usings
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs index b7013bb7..b778c2a4 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs @@ -1,19 +1,18 @@ -using ARMeilleure; using System.Threading; namespace Ryujinx.HLE.HOS.Kernel.Threading { class KCriticalSection { - private Horizon _system; + private readonly KernelContext _context; public object LockObj { get; private set; } private int _recursionCount; - public KCriticalSection(Horizon system) + public KCriticalSection(KernelContext context) { - _system = system; + _context = context; LockObj = new object(); } @@ -36,20 +35,20 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (--_recursionCount == 0) { - if (_system.Scheduler.ThreadReselectionRequested) + if (_context.Scheduler.ThreadReselectionRequested) { - _system.Scheduler.SelectThreads(); + _context.Scheduler.SelectThreads(); } Monitor.Exit(LockObj); - if (_system.Scheduler.MultiCoreScheduling) + if (_context.Scheduler.MultiCoreScheduling) { - lock (_system.Scheduler.CoreContexts) + lock (_context.Scheduler.CoreContexts) { for (int core = 0; core < KScheduler.CpuCoresCount; core++) { - KCoreContext coreContext = _system.Scheduler.CoreContexts[core]; + KCoreContext coreContext = _context.Scheduler.CoreContexts[core]; if (coreContext.ContextSwitchNeeded) { @@ -86,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (doContextSwitch) { - _system.Scheduler.ContextSwitch(); + _context.Scheduler.ContextSwitch(); } } } |