Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes

This commit is contained in:
Subv 2017-01-02 19:38:08 -05:00
parent b6a0355568
commit d3ff5b91e1
5 changed files with 60 additions and 42 deletions

View file

@ -611,6 +611,12 @@ static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) {
return ERR_INVALID_HANDLE;
thread->SetPriority(priority);
thread->UpdatePriority();
// Update the mutexes that this thread is waiting for
for (auto& mutex : thread->pending_mutexes)
mutex->UpdatePriority();
Core::System::GetInstance().PrepareReschedule();
return RESULT_SUCCESS;
}