2019-11-25 18:28:48 -05:00
|
|
|
// Copyright 2019 yuzu emulator team
|
2016-06-14 19:03:30 -04:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-06-18 14:39:26 -04:00
|
|
|
#include <memory>
|
2016-12-14 12:33:49 -05:00
|
|
|
#include <string>
|
2019-11-25 18:28:48 -05:00
|
|
|
|
2020-02-11 09:46:25 -05:00
|
|
|
#include "core/hle/kernel/synchronization_object.h"
|
2019-11-25 18:28:48 -05:00
|
|
|
#include "core/hle/result.h"
|
2018-12-31 18:09:41 -05:00
|
|
|
|
|
|
|
union ResultCode;
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2019-11-26 14:10:49 -05:00
|
|
|
namespace Memory {
|
|
|
|
class Memory;
|
|
|
|
}
|
|
|
|
|
2016-06-14 19:03:30 -04:00
|
|
|
namespace Kernel {
|
|
|
|
|
2018-08-28 12:30:33 -04:00
|
|
|
class KernelCore;
|
2017-01-04 23:23:17 -05:00
|
|
|
class Session;
|
2017-06-29 13:30:34 -04:00
|
|
|
class Thread;
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2020-02-11 09:46:25 -05:00
|
|
|
class ClientSession final : public SynchronizationObject {
|
2016-06-14 19:03:30 -04:00
|
|
|
public:
|
2019-11-24 20:15:51 -05:00
|
|
|
explicit ClientSession(KernelCore& kernel);
|
|
|
|
~ClientSession() override;
|
|
|
|
|
2019-11-25 18:28:48 -05:00
|
|
|
friend class Session;
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2016-11-30 23:28:31 -05:00
|
|
|
std::string GetTypeName() const override {
|
|
|
|
return "ClientSession";
|
|
|
|
}
|
2016-12-05 11:02:08 -05:00
|
|
|
|
2016-11-30 23:28:31 -05:00
|
|
|
std::string GetName() const override {
|
|
|
|
return name;
|
|
|
|
}
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2019-04-11 16:30:52 -04:00
|
|
|
static constexpr HandleType HANDLE_TYPE = HandleType::ClientSession;
|
2016-11-30 23:28:31 -05:00
|
|
|
HandleType GetHandleType() const override {
|
|
|
|
return HANDLE_TYPE;
|
|
|
|
}
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2019-11-25 18:28:48 -05:00
|
|
|
ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory);
|
|
|
|
|
|
|
|
bool ShouldWait(const Thread* thread) const override;
|
|
|
|
|
|
|
|
void Acquire(Thread* thread) override;
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2020-02-11 16:36:39 -05:00
|
|
|
bool IsSignaled() const override;
|
|
|
|
|
2019-03-05 18:24:00 -05:00
|
|
|
private:
|
2019-11-25 18:28:48 -05:00
|
|
|
static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
|
|
|
|
std::shared_ptr<Session> parent,
|
|
|
|
std::string name = "Unknown");
|
|
|
|
|
2017-01-04 23:23:17 -05:00
|
|
|
/// The parent session, which links to the server endpoint.
|
|
|
|
std::shared_ptr<Session> parent;
|
2016-06-14 19:03:30 -04:00
|
|
|
|
2019-03-05 18:24:00 -05:00
|
|
|
/// Name of the client session (optional)
|
|
|
|
std::string name;
|
2016-06-14 19:03:30 -04:00
|
|
|
};
|
|
|
|
|
2018-01-20 02:48:02 -05:00
|
|
|
} // namespace Kernel
|