diff options
author | bunnei <bunneidev@gmail.com> | 2018-01-06 21:55:40 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-01-06 21:55:40 +0100 |
commit | 91f10a1460ba480236b255e4a0135e09b796d5c8 (patch) | |
tree | 9db334faf1a1a562aadba4ba78888b1222f5cdab /src/core/hle/kernel/semaphore.h | |
parent | lm: Assert on unsupported multi-message. (diff) | |
download | yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar.gz yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar.bz2 yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar.lz yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar.xz yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.tar.zst yuzu-91f10a1460ba480236b255e4a0135e09b796d5c8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/semaphore.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index 77c491a24..9cad4450a 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -17,12 +17,14 @@ class Semaphore final : public WaitObject { public: /** * Creates a semaphore. - * @param initial_count Number of slots reserved for other threads - * @param max_count Maximum number of slots the semaphore can have - * @param name Optional name of semaphore - * @return The created semaphore + * @param guest_addr Address of the object tracking the semaphore in guest memory. If specified, + * this semaphore will update the guest object when its state changes. + * @param mutex_addr Optional address of a guest mutex associated with this semaphore, used by + * the OS for implementing events. + * @param name Optional name of semaphore. + * @return The created semaphore. */ - static ResultVal<SharedPtr<Semaphore>> Create(s32 initial_count, s32 max_count, VAddr address, + static ResultVal<SharedPtr<Semaphore>> Create(VAddr guest_addr, VAddr mutex_addr = 0, std::string name = "Unknown"); std::string GetTypeName() const override { @@ -39,8 +41,10 @@ public: s32 max_count; ///< Maximum number of simultaneous holders the semaphore can have s32 available_count; ///< Number of free slots left in the semaphore - VAddr address; std::string name; ///< Name of semaphore (optional) + VAddr guest_addr; ///< Address of the guest semaphore value + VAddr mutex_addr; ///< (optional) Address of guest mutex value associated with this semaphore, + ///< used for implementing events bool ShouldWait(Thread* thread) const override; void Acquire(Thread* thread) override; @@ -55,6 +59,9 @@ public: private: Semaphore(); ~Semaphore() override; + + /// Updates the state of the object tracking this semaphore in guest memory + void UpdateGuestState(); }; -} // namespace +} // namespace Kernel |