From a449e0e11af25b85dfa41c4d774b654637549689 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 26 Nov 2014 14:37:58 -0500 Subject: Mutex: Changed behavior to always release mutex for all threads. --- src/core/hle/kernel/mutex.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') 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) { bool ReleaseMutex(Mutex* mutex) { MutexEraseLock(mutex); - bool woke_threads = false; // Find the next waiting thread for the mutex... - while (!woke_threads && !mutex->waiting_threads.empty()) { + while (!mutex->waiting_threads.empty()) { std::vector::iterator iter = mutex->waiting_threads.begin(); - woke_threads |= ReleaseMutexForThread(mutex, *iter); + ReleaseMutexForThread(mutex, *iter); mutex->waiting_threads.erase(iter); } + // Reset mutex lock thread handle, nothing is waiting - if (!woke_threads) { - mutex->locked = false; - mutex->lock_thread = -1; - } - return woke_threads; + mutex->locked = false; + mutex->lock_thread = -1; + + return true; } /** -- cgit v1.2.3