diff options
author | bunnei <bunneidev@gmail.com> | 2015-04-04 00:40:16 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-04-10 01:06:39 +0200 |
commit | 9c3419ebccf046e0a123e0516ea134547393e451 (patch) | |
tree | 24073b71ade88e5f99db439b824228bdc6b2737d /src/core/hle/kernel/thread.cpp | |
parent | Thread: Implement priority boost for starved threads. (diff) | |
download | yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar.gz yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar.bz2 yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar.lz yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar.xz yuzu-9c3419ebccf046e0a123e0516ea134547393e451.tar.zst yuzu-9c3419ebccf046e0a123e0516ea134547393e451.zip |
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 3a1e15ac6..33d66b986 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -156,9 +156,8 @@ static void PriorityBoostStarvedThreads() { u64 delta = current_ticks - thread->last_running_ticks; if (thread->status == THREADSTATUS_READY && delta > boost_timeout && !thread->idle) { - const s32 boost_priority = std::max(ready_queue.get_first()->current_priority - 1, 0); - ready_queue.move(thread, thread->current_priority, boost_priority); - thread->current_priority = boost_priority; + const s32 priority = std::max(ready_queue.get_first()->current_priority - 1, 0); + thread->BoostPriority(priority); } } } @@ -435,6 +434,11 @@ void Thread::SetPriority(s32 priority) { nominal_priority = current_priority = priority; } +void Thread::BoostPriority(s32 priority) { + ready_queue.move(this, current_priority, priority); + current_priority = priority; +} + SharedPtr<Thread> SetupIdleThread() { // We need to pass a few valid values to get around parameter checking in Thread::Create. auto thread = Thread::Create("idle", Memory::KERNEL_MEMORY_VADDR, THREADPRIO_LOWEST, 0, |