diff options
| author | 2020-02-22 10:27:40 -0400 | |
|---|---|---|
| committer | 2020-02-22 11:18:07 -0400 | |
| commit | d219a96cc828d17932beebead209ba696b92a911 (patch) | |
| tree | 1e973969f39a1901650626699117f93a4d731755 /src/core/hle/kernel/scheduler.cpp | |
| parent | Kernel: Implement Scheduler locks (diff) | |
| download | yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.gz yuzu-d219a96cc828d17932beebead209ba696b92a911.tar.xz yuzu-d219a96cc828d17932beebead209ba696b92a911.zip | |
Kernel: Address Feedback.
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
| -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() { | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | void GlobalScheduler::Lock() { | 360 | void GlobalScheduler::Lock() { |
| 361 | Core::EmuThreadHandle current_thread = kernel.GetCurrentEmuThreadId(); | 361 | Core::EmuThreadHandle current_thread = kernel.GetCurrentEmuThreadID(); |
| 362 | if (current_thread == current_owner) { | 362 | if (current_thread == current_owner) { |
| 363 | ++scope_lock; | 363 | ++scope_lock; |
| 364 | } else { | 364 | } else { |
| 365 | inner_lock.lock(); | 365 | inner_lock.lock(); |
| 366 | current_owner = current_thread; | 366 | current_owner = current_thread; |
| 367 | ASSERT(current_owner != Core::EmuThreadHandle::InvalidHandle()); | ||
| 367 | scope_lock = 1; | 368 | scope_lock = 1; |
| 368 | } | 369 | } |
| 369 | } | 370 | } |
| 370 | 371 | ||
| 371 | void GlobalScheduler::Unlock() { | 372 | void GlobalScheduler::Unlock() { |
| 372 | if (--scope_lock == 0) { | 373 | if (--scope_lock != 0) { |
| 373 | for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { | 374 | ASSERT(scope_lock > 0); |
| 374 | SelectThread(i); | 375 | return; |
| 375 | } | 376 | } |
| 376 | current_owner = Core::EmuThreadHandle::InvalidHandle(); | 377 | for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { |
| 377 | scope_lock = 1; | 378 | SelectThread(i); |
| 378 | inner_lock.unlock(); | ||
| 379 | // TODO(Blinkhawk): Setup the interrupts and change context on current core. | ||
| 380 | } | 379 | } |
| 380 | current_owner = Core::EmuThreadHandle::InvalidHandle(); | ||
| 381 | scope_lock = 1; | ||
| 382 | inner_lock.unlock(); | ||
| 383 | // TODO(Blinkhawk): Setup the interrupts and change context on current core. | ||
| 381 | } | 384 | } |
| 382 | 385 | ||
| 383 | Scheduler::Scheduler(Core::System& system, Core::ARM_Interface& cpu_core, std::size_t core_id) | 386 | Scheduler::Scheduler(Core::System& system, Core::ARM_Interface& cpu_core, std::size_t core_id) |