diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 15 |
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 | ||
| 89 | bool ReleaseMutex(Mutex* mutex) { | 89 | bool 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 | /** |