summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2014-11-30 08:47:49 -0500
committerGravatar bunnei2014-11-30 08:47:49 -0500
commite3d1ffff4be6312ef2f25321cf4100748a7cd0b2 (patch)
tree7db418f0f4f275110f69861c2c228279d92d24fa
parentMerge pull request #226 from bunnei/svc-and-thread-fixes (diff)
parentMutex: Changed behavior to always release mutex for all threads. (diff)
downloadyuzu-e3d1ffff4be6312ef2f25321cf4100748a7cd0b2.tar.gz
yuzu-e3d1ffff4be6312ef2f25321cf4100748a7cd0b2.tar.xz
yuzu-e3d1ffff4be6312ef2f25321cf4100748a7cd0b2.zip
Merge pull request #225 from bunnei/fix-release-mutex
Mutex: Changed behavior to always release mutex for all threads.
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/mutex.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index b303ba128..d07e9761b 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -88,20 +88,19 @@ bool ReleaseMutexForThread(Mutex* mutex, Handle thread) {
88 88
89bool ReleaseMutex(Mutex* mutex) { 89bool ReleaseMutex(Mutex* mutex) {
90 MutexEraseLock(mutex); 90 MutexEraseLock(mutex);
91 bool woke_threads = false;
92 91
93 // Find the next waiting thread for the mutex... 92 // Find the next waiting thread for the mutex...
94 while (!woke_threads && !mutex->waiting_threads.empty()) { 93 while (!mutex->waiting_threads.empty()) {
95 std::vector<Handle>::iterator iter = mutex->waiting_threads.begin(); 94 std::vector<Handle>::iterator iter = mutex->waiting_threads.begin();
96 woke_threads |= ReleaseMutexForThread(mutex, *iter); 95 ReleaseMutexForThread(mutex, *iter);
97 mutex->waiting_threads.erase(iter); 96 mutex->waiting_threads.erase(iter);
98 } 97 }
98
99 // Reset mutex lock thread handle, nothing is waiting 99 // Reset mutex lock thread handle, nothing is waiting
100 if (!woke_threads) { 100 mutex->locked = false;
101 mutex->locked = false; 101 mutex->lock_thread = -1;
102 mutex->lock_thread = -1; 102
103 } 103 return true;
104 return woke_threads;
105} 104}
106 105
107/** 106/**