diff options
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 31129fd86..e4ff1ef40 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -32,10 +32,10 @@ public: | |||
| 32 | * @param wait Boolean wait set if current thread should wait as a result of sync operation | 32 | * @param wait Boolean wait set if current thread should wait as a result of sync operation |
| 33 | * @return Result of operation, 0 on success, otherwise error code | 33 | * @return Result of operation, 0 on success, otherwise error code |
| 34 | */ | 34 | */ |
| 35 | Result SyncRequest(bool* wait) override { | 35 | ResultVal<bool> SyncRequest() override { |
| 36 | // TODO(bunnei): ImplementMe | 36 | // TODO(bunnei): ImplementMe |
| 37 | locked = true; | 37 | locked = true; |
| 38 | return 0; | 38 | return MakeResult<bool>(false); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| @@ -43,15 +43,14 @@ public: | |||
| 43 | * @param wait Boolean wait set if current thread should wait as a result of sync operation | 43 | * @param wait Boolean wait set if current thread should wait as a result of sync operation |
| 44 | * @return Result of operation, 0 on success, otherwise error code | 44 | * @return Result of operation, 0 on success, otherwise error code |
| 45 | */ | 45 | */ |
| 46 | Result WaitSynchronization(bool* wait) override { | 46 | ResultVal<bool> WaitSynchronization() override { |
| 47 | // TODO(bunnei): ImplementMe | 47 | // TODO(bunnei): ImplementMe |
| 48 | *wait = locked; | 48 | bool wait = locked; |
| 49 | |||
| 50 | if (locked) { | 49 | if (locked) { |
| 51 | Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); | 50 | Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); |
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | return 0; | 53 | return MakeResult<bool>(wait); |
| 55 | } | 54 | } |
| 56 | }; | 55 | }; |
| 57 | 56 | ||
| @@ -119,15 +118,17 @@ bool ReleaseMutex(Mutex* mutex) { | |||
| 119 | * Releases a mutex | 118 | * Releases a mutex |
| 120 | * @param handle Handle to mutex to release | 119 | * @param handle Handle to mutex to release |
| 121 | */ | 120 | */ |
| 122 | Result ReleaseMutex(Handle handle) { | 121 | ResultCode ReleaseMutex(Handle handle) { |
| 123 | Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(handle); | 122 | Mutex* mutex = Kernel::g_object_pool.Get<Mutex>(handle); |
| 124 | 123 | if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel); | |
| 125 | _assert_msg_(KERNEL, (mutex != nullptr), "ReleaseMutex tried to release a nullptr mutex!"); | ||
| 126 | 124 | ||
| 127 | if (!ReleaseMutex(mutex)) { | 125 | if (!ReleaseMutex(mutex)) { |
| 128 | return -1; | 126 | // TODO(yuriks): Verify error code, this one was pulled out of thin air. I'm not even sure |
| 127 | // what error condition this is supposed to be signaling. | ||
| 128 | return ResultCode(ErrorDescription::AlreadyDone, ErrorModule::Kernel, | ||
| 129 | ErrorSummary::NothingHappened, ErrorLevel::Temporary); | ||
| 129 | } | 130 | } |
| 130 | return 0; | 131 | return RESULT_SUCCESS; |
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | /** | 134 | /** |