yuzu/src/core/hle/kernel/k_server_session.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
1.9 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <list>
#include <memory>
2015-06-21 14:40:28 +02:00
#include <string>
#include <utility>
2023-04-29 21:10:09 +02:00
#include "common/intrusive_list.h"
#include "core/hle/kernel/k_light_lock.h"
2022-10-15 03:24:25 +02:00
#include "core/hle/kernel/k_session_request.h"
#include "core/hle/kernel/k_synchronization_object.h"
2015-06-21 14:40:28 +02:00
#include "core/hle/result.h"
2023-02-19 20:42:12 +01:00
namespace Service {
class HLERequestContext;
class SessionRequestManager;
} // namespace Service
namespace Kernel {
class KernelCore;
class KSession;
class KThread;
class KServerSession final : public KSynchronizationObject,
2023-04-29 21:10:09 +02:00
public Common::IntrusiveListBaseNode<KServerSession> {
KERNEL_AUTOOBJECT_TRAITS(KServerSession, KSynchronizationObject);
friend class ServiceThread;
public:
2023-03-07 16:49:41 +01:00
explicit KServerSession(KernelCore& kernel);
~KServerSession() override;
void Destroy() override;
2023-03-07 02:34:25 +01:00
void Initialize(KSession* p) {
m_parent = p;
}
const KSession* GetParent() const {
2023-03-07 02:34:25 +01:00
return m_parent;
2016-12-01 05:28:31 +01:00
}
bool IsSignaled() const override;
void OnClientClosed();
/// TODO: flesh these out to match the real kernel
2022-10-15 03:24:25 +02:00
Result OnRequest(KSessionRequest* request);
Result SendReply(bool is_hle = false);
2023-02-19 20:42:12 +01:00
Result ReceiveRequest(std::shared_ptr<Service::HLERequestContext>* out_context = nullptr,
std::weak_ptr<Service::SessionRequestManager> manager = {});
2022-10-26 23:32:14 +02:00
Result SendReplyHLE() {
return SendReply(true);
}
private:
/// Frees up waiting client sessions when this server session is about to die
void CleanupRequests();
/// KSession that owns this KServerSession
2023-03-07 02:34:25 +01:00
KSession* m_parent{};
/// List of threads which are pending a reply.
2023-04-29 21:10:09 +02:00
using RequestList = Common::IntrusiveListBaseTraits<KSessionRequest>::ListType;
RequestList m_request_list{};
2022-10-30 04:05:56 +01:00
KSessionRequest* m_current_request{};
KLightLock m_lock;
};
} // namespace Kernel