mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-20 18:37:54 -05:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user