diff options
author | Lioncash <mathew1800@gmail.com> | 2019-03-14 05:29:54 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-03-15 01:55:52 +0100 |
commit | 555cd26ec2b848634370a14d41b7e79b6c6beecd (patch) | |
tree | 4ec6b8245280f94b44969356c9f2a44b22abd00e /src/core/hle/kernel/mutex.cpp | |
parent | Merge pull request #2230 from lioncash/global (diff) | |
download | yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar.gz yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar.bz2 yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar.lz yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar.xz yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.tar.zst yuzu-555cd26ec2b848634370a14d41b7e79b6c6beecd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 0743670ad..260e25fde 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <map> #include <utility> #include <vector> @@ -10,8 +9,10 @@ #include "core/core.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/handle_table.h" +#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/object.h" +#include "core/hle/kernel/process.h" #include "core/hle/kernel/thread.h" #include "core/hle/result.h" #include "core/memory.h" @@ -57,13 +58,17 @@ static void TransferMutexOwnership(VAddr mutex_addr, SharedPtr<Thread> current_t } } -ResultCode Mutex::TryAcquire(HandleTable& handle_table, VAddr address, Handle holding_thread_handle, +Mutex::Mutex(Core::System& system) : system{system} {} +Mutex::~Mutex() = default; + +ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, Handle requesting_thread_handle) { // The mutex address must be 4-byte aligned if ((address % sizeof(u32)) != 0) { return ERR_INVALID_ADDRESS; } + const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); SharedPtr<Thread> holding_thread = handle_table.Get<Thread>(holding_thread_handle); SharedPtr<Thread> requesting_thread = handle_table.Get<Thread>(requesting_thread_handle); |