diff options
author | bunnei <bunneidev@gmail.com> | 2014-11-24 15:31:53 -0500 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-11-24 15:31:53 -0500 |
commit | bb730855e58d18d8964d158a55822c40503d548f (patch) | |
tree | 9c3ff113839583d1deca837e9888d81f25d485a0 /src/core/hle/kernel/mutex.cpp | |
parent | ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1 (diff) | |
parent | 8189593255df8ab4abb699082f2c48baa3b0656b (diff) |
Merge pull request #147 from yuriks/error-codes
Error codes
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 31129fd86e..b303ba1284 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -27,31 +27,20 @@ public: std::vector<Handle> waiting_threads; ///< Threads that are waiting for the mutex std::string name; ///< Name of mutex (optional) - /** - * Synchronize kernel object - * @param wait Boolean wait set if current thread should wait as a result of sync operation - * @return Result of operation, 0 on success, otherwise error code - */ - Result SyncRequest(bool* wait) override { + ResultVal<bool> SyncRequest() override { // TODO(bunnei): ImplementMe locked = true; - return 0; + return MakeResult<bool>(false); } - /** - * Wait for kernel object to synchronize - * @param wait Boolean wait set if current thread should wait as a result of sync operation - * @return Result of operation, 0 on success, otherwise error code - */ - Result WaitSynchronization(bool* wait) override { + ResultVal<bool> WaitSynchronization() override { // TODO(bunnei): ImplementMe - *wait = locked; - + bool wait = locked; if (locked) { Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); } - return 0; + return MakeResult<bool>(wait); } }; @@ -119,15 +108,17 @@ bool ReleaseMutex(Mutex* mutex) { * Releases a mutex * @param handle Handle to mutex to release */ -Result ReleaseMutex(Handle handle) { - Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(handle); - - _assert_msg_(KERNEL, (mutex != nullptr), "ReleaseMutex tried to release a nullptr mutex!"); +ResultCode ReleaseMutex(Handle handle) { + Mutex* mutex = Kernel::g_object_pool.Get<Mutex>(handle); + if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel); if (!ReleaseMutex(mutex)) { - return -1; + // TODO(yuriks): Verify error code, this one was pulled out of thin air. I'm not even sure + // what error condition this is supposed to be signaling. + return ResultCode(ErrorDescription::AlreadyDone, ErrorModule::Kernel, + ErrorSummary::NothingHappened, ErrorLevel::Temporary); } - return 0; + return RESULT_SUCCESS; } /** |