diff options
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 16c95782a..5a96d5e90 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 11 | #include "core/core.h" | 11 | #include "core/core.h" |
| 12 | #include "core/arm/exclusive_monitor.h" | ||
| 13 | #include "core/core.h" | 12 | #include "core/core.h" |
| 14 | #include "core/hle/kernel/errors.h" | 13 | #include "core/hle/kernel/errors.h" |
| 15 | #include "core/hle/kernel/handle_table.h" | 14 | #include "core/hle/kernel/handle_table.h" |
| @@ -135,12 +134,8 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr | |||
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address); | 136 | auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address); |
| 138 | auto& monitor = system.Monitor(); | ||
| 139 | const std::size_t current_core = system.CurrentCoreIndex(); | ||
| 140 | if (new_owner == nullptr) { | 137 | if (new_owner == nullptr) { |
| 141 | do { | 138 | system.Memory().Write32(address, 0); |
| 142 | monitor.SetExclusive32(current_core, address); | ||
| 143 | } while (!monitor.ExclusiveWrite32(current_core, address, 0)); | ||
| 144 | return {RESULT_SUCCESS, nullptr}; | 139 | return {RESULT_SUCCESS, nullptr}; |
| 145 | } | 140 | } |
| 146 | // Transfer the ownership of the mutex from the previous owner to the new one. | 141 | // Transfer the ownership of the mutex from the previous owner to the new one. |
| @@ -154,9 +149,7 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr | |||
| 154 | new_owner->SetLockOwner(nullptr); | 149 | new_owner->SetLockOwner(nullptr); |
| 155 | new_owner->ResumeFromWait(); | 150 | new_owner->ResumeFromWait(); |
| 156 | 151 | ||
| 157 | do { | 152 | system.Memory().Write32(address, mutex_value); |
| 158 | monitor.SetExclusive32(current_core, address); | ||
| 159 | } while (!monitor.ExclusiveWrite32(current_core, address, mutex_value)); | ||
| 160 | return {RESULT_SUCCESS, new_owner}; | 153 | return {RESULT_SUCCESS, new_owner}; |
| 161 | } | 154 | } |
| 162 | 155 | ||