1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-08 13:11:49 +00:00

meso: KPort mini skeleton

This commit is contained in:
TuxSH 2018-11-12 14:52:57 +01:00 committed by Michael Scire
parent acf32f841c
commit 173bde2eca
6 changed files with 161 additions and 0 deletions

View file

@ -0,0 +1,34 @@
#pragma once
#include <mesosphere/core/KSynchronizationObject.hpp>
#include <mesosphere/core/util.hpp>
#include <mesosphere/core/Result.hpp>
#include <mesosphere/interfaces/IClient.hpp>
#include <mesosphere/threading/KThread.hpp>
namespace mesosphere
{
class KPort;
class KServerPort;
class KClientPort final :
public KSynchronizationObject,
public IClient<KPort, KClientPort, KServerPort> {
public:
MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, ClientPort);
virtual ~KClientPort();
virtual bool IsSignaled() const override;
private:
friend class KPort;
};
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ClientPort);
}

View file

@ -0,0 +1,36 @@
#pragma once
#include <mesosphere/core/util.hpp>
#include <mesosphere/core/Result.hpp>
#include <mesosphere/interfaces/IClientServerParent.hpp>
#include <mesosphere/interfaces/ISetAllocated.hpp>
#include <mesosphere/processes/KClientPort.hpp>
#include <mesosphere/processes/KServerPort.hpp>
namespace mesosphere
{
class KPort final :
public KAutoObject,
public ISetAllocated<KPort>,
public IClientServerParent<KPort, KClientPort, KServerPort> {
public:
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Port);
virtual ~KPort();
Result Initialize();
private:
friend class KClientPort;
friend class KServerPort;
bool isClientAlive = false;
bool isServerAlive = false;
bool isLight = false;
};
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(Port);
}

View file

@ -0,0 +1,31 @@
#pragma once
#include <mesosphere/core/KSynchronizationObject.hpp>
#include <mesosphere/processes/KLightServerSession.hpp>
namespace mesosphere
{
class KPort;
class KClientPort;
class KServerPort final :
public KSynchronizationObject,
public IServer<KPort, KClientPort, KServerPort> {
public:
MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, ServerPort);
virtual ~KServerPort();
virtual bool IsSignaled() const override;
private:
friend class KPort;
};
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ServerPort);
}

View file

@ -0,0 +1,20 @@
#include <mesosphere/processes/KPort.hpp>
#include <mesosphere/threading/KScopedCriticalSection.hpp>
#include <mesosphere/threading/KThread.hpp>
#include <mesosphere/core/KCoreContext.hpp>
namespace mesosphere
{
KClientPort::~KClientPort()
{
KScopedCriticalSection critsec{};
parent->isClientAlive = false;
}
bool KClientPort::IsSignaled() const
{
return false; // TODO
}
}

View file

@ -0,0 +1,20 @@
#include <mesosphere/processes/KPort.hpp>
#include <mesosphere/core/KCoreContext.hpp>
namespace mesosphere
{
KPort::~KPort()
{
}
Result KPort::Initialize()
{
SetClientServerParent();
isClientAlive = true;
isServerAlive = true;
return ResultSuccess();
}
}

View file

@ -0,0 +1,20 @@
#include <mesosphere/processes/KPort.hpp>
#include <mesosphere/threading/KScopedCriticalSection.hpp>
#include <mesosphere/threading/KThread.hpp>
#include <mesosphere/core/KCoreContext.hpp>
namespace mesosphere
{
KServerPort::~KServerPort()
{
KScopedCriticalSection critsec{};
parent->isServerAlive = false;
}
bool KServerPort::IsSignaled() const
{
return false; // TODO
}
}