aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/semaphore.h
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-01-08 14:14:30 -0500
committerbunnei <bunneidev@gmail.com>2018-01-08 21:12:54 -0500
commitdb3a5251664ae77f5e67dba571a11d208e448a86 (patch)
treef53b53b9620ca36a5b8085e3e9d2b603477142fc /src/core/hle/kernel/semaphore.h
parent1bbe9309daa96b5fbac7a2df5a2edcb17ab7a05c (diff)
Kernel: Actually wake up the requested number of threads in Semaphore::Release.
Also properly keep track of data in guest memory, this fixes managing the semaphore from userland. It was found that Semaphores are actually Condition Variables, with Release(1) and Release(-1) being equivalent to notify_one and notify_all. We should change the name of the class to reflect this.
Diffstat (limited to 'src/core/hle/kernel/semaphore.h')
-rw-r--r--src/core/hle/kernel/semaphore.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h
index e80230cac..7254eb26d 100644
--- a/src/core/hle/kernel/semaphore.h
+++ b/src/core/hle/kernel/semaphore.h
@@ -13,6 +13,7 @@
namespace Kernel {
+// TODO(Subv): This is actually a Condition Variable.
class Semaphore final : public WaitObject {
public:
/**
@@ -39,8 +40,9 @@ public:
return HANDLE_TYPE;
}
- s32 max_count; ///< Maximum number of simultaneous holders the semaphore can have
- s32 available_count; ///< Number of free slots left in the semaphore
+ s32 GetAvailableCount() const;
+ void SetAvailableCount(s32 value) const;
+
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,
@@ -59,9 +61,6 @@ public:
private:
Semaphore();
~Semaphore() override;
-
- /// Updates the state of the object tracking this semaphore in guest memory
- void UpdateGuestState();
};
} // namespace Kernel