summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/semaphore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/semaphore.h')
-rw-r--r--src/core/hle/kernel/semaphore.h21
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