1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2025-01-10 11:26:15 +00:00
Atmosphere/mesosphere/source/processes/KServerPort.cpp

47 lines
1.1 KiB
C++
Raw Normal View History

2018-11-12 13:52:57 +00:00
#include <mesosphere/processes/KPort.hpp>
#include <mesosphere/threading/KScopedCriticalSection.hpp>
#include <mesosphere/threading/KThread.hpp>
#include <mesosphere/core/KCoreContext.hpp>
namespace mesosphere
{
KServerPort::~KServerPort()
{
2018-11-13 10:01:46 +00:00
KCriticalSection &critsec = KScheduler::GetCriticalSection();
critsec.lock();
2018-11-12 13:52:57 +00:00
parent->isServerAlive = false;
2018-11-13 10:01:46 +00:00
// TODO: normal sessions
lightServerSessions.clear_and_dispose(
[&critsec](KLightServerSession *s) {
critsec.unlock();
intrusive_ptr_release(s);
critsec.lock();
}
);
critsec.unlock();
2018-11-12 13:52:57 +00:00
}
bool KServerPort::IsSignaled() const
{
2018-11-12 14:48:03 +00:00
if (!parent->isLight) {
return false; // TODO
} else {
return !lightServerSessions.empty();
}
}
2018-11-13 00:14:55 +00:00
Result KServerPort::AddLightServerSession(KLightServerSession &lightServerSession)
2018-11-12 14:48:03 +00:00
{
KScopedCriticalSection critsec{};
bool wasEmpty = lightServerSessions.empty();
lightServerSessions.push_back(lightServerSession);
if (wasEmpty && !lightServerSessions.empty()) {
NotifyWaiters();
}
return ResultSuccess();
2018-11-12 13:52:57 +00:00
}
}