diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-24 02:00:15 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:52 +0200 |
commit | 626f746971d1d3216a38b20680959df3a1f5f256 (patch) | |
tree | d9b9448732e264e84557e12d7a14a40f00cb006f /src/core/hle/kernel/k_client_port.h | |
parent | hle: kernel: Migrate KServerPort to KAutoObject. (diff) | |
download | yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar.gz yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar.bz2 yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar.lz yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar.xz yuzu-626f746971d1d3216a38b20680959df3a1f5f256.tar.zst yuzu-626f746971d1d3216a38b20680959df3a1f5f256.zip |
Diffstat (limited to 'src/core/hle/kernel/k_client_port.h')
-rw-r--r-- | src/core/hle/kernel/k_client_port.h | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/core/hle/kernel/k_client_port.h b/src/core/hle/kernel/k_client_port.h index 60dea4763..43a17f4a4 100644 --- a/src/core/hle/kernel/k_client_port.h +++ b/src/core/hle/kernel/k_client_port.h @@ -15,7 +15,7 @@ namespace Kernel { class KClientSession; class KernelCore; -class KServerPort; +class KPort; class KClientPort final : public KSynchronizationObject { KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject); @@ -24,30 +24,33 @@ public: explicit KClientPort(KernelCore& kernel); virtual ~KClientPort() override; - friend class KServerPort; + void Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_); + void OnSessionFinalized(); + void OnServerClosed(); - void Initialize(s32 max_sessions_, std::string&& name_); - - KServerPort* GetServerPort() const; + constexpr const KPort* GetParent() const { + return parent; + } - /** - * Creates a new Session pair, adds the created ServerSession to the associated ServerPort's - * list of pending sessions, and signals the ServerPort, causing any threads - * waiting on it to awake. - * @returns ClientSession The client endpoint of the created Session pair, or error code. - */ - ResultVal<KClientSession*> Connect(); + s32 GetNumSessions() const { + return num_sessions; + } + s32 GetPeakSessions() const { + return peak_sessions; + } + s32 GetMaxSessions() const { + return max_sessions; + } - /** - * Signifies that a previously active connection has been closed, - * decreasing the total number of active connections to this port. - */ - void ConnectionClosed(); + bool IsLight() const; + bool IsServerClosed() const; // Overridden virtual functions. virtual void Destroy() override; virtual bool IsSignaled() const override; + ResultCode CreateSession(KClientSession** out); + // DEPRECATED std::string GetTypeName() const override { @@ -63,10 +66,11 @@ public: } private: - KServerPort* server_port{}; ///< ServerPort associated with this client port. - s32 max_sessions{}; ///< Maximum number of simultaneous sessions the port can have - std::atomic<s32> num_sessions{}; ///< Number of currently open sessions to this port - std::string name; ///< Name of client port (optional) + std::atomic<s32> num_sessions{}; + std::atomic<s32> peak_sessions{}; + s32 max_sessions{}; + KPort* parent{}; + std::string name; }; } // namespace Kernel |