summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/mutex.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-04-10 05:05:49 +0200
committerbunnei <bunneidev@gmail.com>2015-04-10 05:05:49 +0200
commit6f1143885bcc02642b707b51355fe4b6cd5375c7 (patch)
treefe1307919e7087df41c498b971016ffa931d6594 /src/core/hle/kernel/mutex.cpp
parentMerge pull request #690 from Zaneo/sharedmemory (diff)
parentSVC: Assert on unsupported CreateThread processor ID. (diff)
downloadyuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.gz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.bz2
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.lz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.xz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.zst
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.zip
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
-rw-r--r--src/core/hle/kernel/mutex.cpp10
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() {