diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-22 15:27:40 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2020-02-22 16:18:07 +0100 |
commit | d219a96cc828d17932beebead209ba696b92a911 (patch) | |
tree | 1e973969f39a1901650626699117f93a4d731755 /src/core/hle/kernel/scheduler.cpp | |
parent | Kernel: Implement Scheduler locks (diff) | |
download | yuzu-d219a96cc828d17932beebead209ba696b92a911.tar yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.gz yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.bz2 yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.lz yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.xz yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.zst yuzu-d219a96cc828d17932beebead209ba696b92a911.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 9556df951..e5892727e 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -358,26 +358,29 @@ void GlobalScheduler::Shutdown() { } void GlobalScheduler::Lock() { - Core::EmuThreadHandle current_thread = kernel.GetCurrentEmuThreadId(); + Core::EmuThreadHandle current_thread = kernel.GetCurrentEmuThreadID(); if (current_thread == current_owner) { ++scope_lock; } else { inner_lock.lock(); current_owner = current_thread; + ASSERT(current_owner != Core::EmuThreadHandle::InvalidHandle()); scope_lock = 1; } } void GlobalScheduler::Unlock() { - if (--scope_lock == 0) { - for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { - SelectThread(i); - } - current_owner = Core::EmuThreadHandle::InvalidHandle(); - scope_lock = 1; - inner_lock.unlock(); - // TODO(Blinkhawk): Setup the interrupts and change context on current core. + if (--scope_lock != 0) { + ASSERT(scope_lock > 0); + return; + } + for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { + SelectThread(i); } + current_owner = Core::EmuThreadHandle::InvalidHandle(); + scope_lock = 1; + inner_lock.unlock(); + // TODO(Blinkhawk): Setup the interrupts and change context on current core. } Scheduler::Scheduler(Core::System& system, Core::ARM_Interface& cpu_core, std::size_t core_id) |