aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-12-09 19:20:05 -0300
committerGitHub <noreply@github.com>2020-12-09 19:20:05 -0300
commit48278905d1470f89be31668c738397f569af156a (patch)
tree2e35b0695b33c8eb723f5948e3f6f040d84cfe76 /Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs
parent3484265d37732b32951709e5abfa52a260db349d (diff)
Rewrite scheduler context switch code (#1786)
* Rewrite scheduler context switch code * Fix race in UnmapIpcRestorePermission * Fix thread exit issue that could leave the scheduler in a invalid state * Change context switch method to not wait on guest thread, remove spin wait, use SignalAndWait to pass control * Remove multi-core setting (it is always on now) * Re-enable assert * Remove multicore from default config and schema * Fix race in KTimeManager
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs66
1 files changed, 0 insertions, 66 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs b/Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs
deleted file mode 100644
index c2597990..00000000
--- a/Ryujinx.HLE/HOS/Kernel/Threading/HleCoreManager.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System.Collections.Concurrent;
-using System.Threading;
-
-namespace Ryujinx.HLE.HOS.Kernel.Threading
-{
- class HleCoreManager
- {
- private class PausableThread
- {
- public ManualResetEvent Event { get; private set; }
-
- public bool IsExiting { get; set; }
-
- public PausableThread()
- {
- Event = new ManualResetEvent(false);
- }
- }
-
- private ConcurrentDictionary<Thread, PausableThread> _threads;
-
- public HleCoreManager()
- {
- _threads = new ConcurrentDictionary<Thread, PausableThread>();
- }
-
- public void Set(Thread thread)
- {
- GetThread(thread).Event.Set();
- }
-
- public void Reset(Thread thread)
- {
- GetThread(thread).Event.Reset();
- }
-
- public void Wait(Thread thread)
- {
- PausableThread pausableThread = GetThread(thread);
-
- if (!pausableThread.IsExiting)
- {
- pausableThread.Event.WaitOne();
- }
- }
-
- public void Exit(Thread thread)
- {
- GetThread(thread).IsExiting = true;
- }
-
- private PausableThread GetThread(Thread thread)
- {
- return _threads.GetOrAdd(thread, (key) => new PausableThread());
- }
-
- public void RemoveThread(Thread thread)
- {
- if (_threads.TryRemove(thread, out PausableThread pausableThread))
- {
- pausableThread.Event.Set();
- pausableThread.Event.Dispose();
- }
- }
- }
-} \ No newline at end of file