From 6e69cd9284c0ba4bb25560f83dcea298169bdf7b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 19 Apr 2018 00:19:22 -0300 Subject: [PATCH] Fix bad merge, and a few other fixes --- Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs | 10 ++++++++++ Ryujinx.Core/OsHle/Horizon.cs | 2 ++ Ryujinx.Core/OsHle/Process.cs | 2 -- Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs b/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs index 238febd06c..7cdf5f9caa 100644 --- a/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs +++ b/Ryujinx.Core/OsHle/Handles/KProcessScheduler.cs @@ -95,6 +95,11 @@ namespace Ryujinx.Core.OsHle.Handles return Threads.Contains(SchedThread); } } + + public bool Remove(SchedulerThread SchedThread) + { + return Threads.Remove(SchedThread); + } } private ConcurrentDictionary AllThreads; @@ -153,6 +158,11 @@ namespace Ryujinx.Core.OsHle.Handles lock (SchedLock) { + if (AllThreads.TryRemove(Thread, out SchedulerThread SchedThread)) + { + WaitingToRun[Thread.ProcessorId].Remove(SchedThread); + } + SchedulerThread NewThread = WaitingToRun[Thread.ProcessorId].Pop(); if (NewThread == null) diff --git a/Ryujinx.Core/OsHle/Horizon.cs b/Ryujinx.Core/OsHle/Horizon.cs index 6442025f7f..9e113080c3 100644 --- a/Ryujinx.Core/OsHle/Horizon.cs +++ b/Ryujinx.Core/OsHle/Horizon.cs @@ -179,6 +179,8 @@ namespace Ryujinx.Core.OsHle } VsyncEvent.Dispose(); + + Scheduler.Dispose(); } } } diff --git a/Ryujinx.Core/OsHle/Process.cs b/Ryujinx.Core/OsHle/Process.cs index f56103dc24..bacca9a397 100644 --- a/Ryujinx.Core/OsHle/Process.cs +++ b/Ryujinx.Core/OsHle/Process.cs @@ -370,8 +370,6 @@ namespace Ryujinx.Core.OsHle INvDrvServices.NvMapsById.DeleteProcess(this); INvDrvServices.NvMapsFb .DeleteProcess(this); - Scheduler.Dispose(); - AppletState.Dispose(); SvcHandler.Dispose(); diff --git a/Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs b/Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs index c89bd2d236..b27d144895 100644 --- a/Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs +++ b/Ryujinx.Core/OsHle/Services/Aud/IAudioDeviceService.cs @@ -25,8 +25,9 @@ namespace Ryujinx.Core.OsHle.Services.Aud }; SystemEvent = new KEvent(); + //TODO: We shouldn't be signaling this here. - SystemEvent.Handle.Set(); + SystemEvent.WaitEvent.Set(); } public long ListAudioDeviceName(ServiceCtx Context)