diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-05-13 22:00:29 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-13 22:00:29 -0300 |
| commit | b2b1d7dcd7bef8b78c7cea9d81339ba664fe7578 (patch) | |
| tree | 5ac5d5eaf103c4e72b4d418adab38b921fb28d11 /Ryujinx.Core/OsHle/Handles | |
| parent | 4546d1b9be1052bbf82858d97795b33355bf64da (diff) | |
Better implementation of SetThreadCoreMask that allows changing the Core Mask (untested, no clue if it actually works)
Diffstat (limited to 'Ryujinx.Core/OsHle/Handles')
| -rw-r--r-- | Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs | 22 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Handles/KThread.cs | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs b/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs index a154b1c6..33f7fb14 100644 --- a/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs +++ b/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs @@ -196,6 +196,28 @@ namespace Ryujinx.Core.OsHle.Handles Resume(Thread); } + public bool TryRunning(KThread Thread) + { + if (!AllThreads.TryGetValue(Thread, out SchedulerThread SchedThread)) + { + throw new InvalidOperationException(); + } + + lock (SchedLock) + { + if (WaitingToRun.HasThread(SchedThread) && AddActiveCore(Thread)) + { + WaitingToRun.Remove(SchedThread); + + RunThread(SchedThread); + + return true; + } + + return false; + } + } + public void Resume(KThread Thread) { if (!AllThreads.TryGetValue(Thread, out SchedulerThread SchedThread)) diff --git a/Ryujinx.Core/OsHle/Handles/KThread.cs b/Ryujinx.Core/OsHle/Handles/KThread.cs index 1a044665..a430974c 100644 --- a/Ryujinx.Core/OsHle/Handles/KThread.cs +++ b/Ryujinx.Core/OsHle/Handles/KThread.cs @@ -22,7 +22,7 @@ namespace Ryujinx.Core.OsHle.Handles public int ActualPriority { get; private set; } public int WantedPriority { get; private set; } - public int IdealCore { get; private set; } + public int IdealCore { get; set; } public int ActualCore { get; set; } public int WaitHandle { get; set; } |
