diff options
author | bunnei <bunneidev@gmail.com> | 2021-08-07 08:27:33 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-08-07 21:18:47 +0200 |
commit | 1798c3b6b0cd4a088be821c604c7ff1617afde7b (patch) | |
tree | 67e2085902210bbe81dc4afacd5118ef045d20e2 /src/core | |
parent | core: cpu_manager: Use KScopedDisableDispatch. (diff) | |
download | yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar.gz yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar.bz2 yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar.lz yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar.xz yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.tar.zst yuzu-1798c3b6b0cd4a088be821c604c7ff1617afde7b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index f5236dfea..6ddbae52c 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp @@ -376,20 +376,18 @@ void KScheduler::ClearSchedulerUpdateNeeded(KernelCore& kernel) { } void KScheduler::DisableScheduling(KernelCore& kernel) { - if (auto* scheduler = kernel.CurrentScheduler(); scheduler) { - ASSERT(scheduler->GetCurrentThread()->GetDisableDispatchCount() >= 0); - scheduler->GetCurrentThread()->DisableDispatch(); - } + ASSERT(GetCurrentThreadPointer(kernel)->GetDisableDispatchCount() >= 0); + GetCurrentThreadPointer(kernel)->DisableDispatch(); } void KScheduler::EnableScheduling(KernelCore& kernel, u64 cores_needing_scheduling) { - if (auto* scheduler = kernel.CurrentScheduler(); scheduler) { - ASSERT(scheduler->GetCurrentThread()->GetDisableDispatchCount() >= 1); - if (scheduler->GetCurrentThread()->GetDisableDispatchCount() >= 1) { - scheduler->GetCurrentThread()->EnableDispatch(); - } + ASSERT(GetCurrentThreadPointer(kernel)->GetDisableDispatchCount() >= 1); + + if (GetCurrentThreadPointer(kernel)->GetDisableDispatchCount() > 1) { + GetCurrentThreadPointer(kernel)->EnableDispatch(); + } else { + RescheduleCores(kernel, cores_needing_scheduling); } - RescheduleCores(kernel, cores_needing_scheduling); } u64 KScheduler::UpdateHighestPriorityThreads(KernelCore& kernel) { @@ -646,6 +644,7 @@ void KScheduler::RescheduleCurrentCore() { if (phys_core.IsInterrupted()) { phys_core.ClearInterrupt(); } + guard.Lock(); if (state.needs_scheduling.load()) { Schedule(); @@ -662,10 +661,6 @@ void KScheduler::OnThreadStart() { void KScheduler::Unload(KThread* thread) { ASSERT(thread); - if (!thread) { - return; - } - LOG_TRACE(Kernel, "core {}, unload thread {}", core_id, thread ? thread->GetName() : "nullptr"); if (thread->IsCallingSvc()) { |