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/mutex.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 '')
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index be2c49706..ebc9e79d7 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -56,7 +56,15 @@ SharedPtr<Mutex> Mutex::Create(bool initial_locked, std::string name) { } bool Mutex::ShouldWait() { - return lock_count > 0 && holding_thread != GetCurrentThread();; + auto thread = GetCurrentThread(); + bool wait = lock_count > 0 && holding_thread != thread; + + // If the holding thread of the mutex is lower priority than this thread, that thread should + // temporarily inherit this thread's priority + if (wait && thread->current_priority < holding_thread->current_priority) + holding_thread->BoostPriority(thread->current_priority); + + return wait; } void Mutex::Acquire() { |