|
|
@ -156,9 +156,8 @@ static void PriorityBoostStarvedThreads() {
|
|
|
|
u64 delta = current_ticks - thread->last_running_ticks;
|
|
|
|
u64 delta = current_ticks - thread->last_running_ticks;
|
|
|
|
|
|
|
|
|
|
|
|
if (thread->status == THREADSTATUS_READY && delta > boost_timeout && !thread->idle) {
|
|
|
|
if (thread->status == THREADSTATUS_READY && delta > boost_timeout && !thread->idle) {
|
|
|
|
const s32 boost_priority = std::max(ready_queue.get_first()->current_priority - 1, 0);
|
|
|
|
const s32 priority = std::max(ready_queue.get_first()->current_priority - 1, 0);
|
|
|
|
ready_queue.move(thread, thread->current_priority, boost_priority);
|
|
|
|
thread->BoostPriority(priority);
|
|
|
|
thread->current_priority = boost_priority;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -435,6 +434,11 @@ void Thread::SetPriority(s32 priority) {
|
|
|
|
nominal_priority = current_priority = priority;
|
|
|
|
nominal_priority = current_priority = priority;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Thread::BoostPriority(s32 priority) {
|
|
|
|
|
|
|
|
ready_queue.move(this, current_priority, priority);
|
|
|
|
|
|
|
|
current_priority = priority;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SharedPtr<Thread> SetupIdleThread() {
|
|
|
|
SharedPtr<Thread> SetupIdleThread() {
|
|
|
|
// We need to pass a few valid values to get around parameter checking in Thread::Create.
|
|
|
|
// 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,
|
|
|
|
auto thread = Thread::Create("idle", Memory::KERNEL_MEMORY_VADDR, THREADPRIO_LOWEST, 0,
|
|
|
|