mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
kern: refactor to use m_ for member variables
This commit is contained in:
parent
0bf2ade76f
commit
968f50bc07
135 changed files with 3727 additions and 3734 deletions
|
@ -22,7 +22,7 @@ namespace ams::kern {
|
|||
|
||||
this->CleanupRequests();
|
||||
|
||||
this->parent->OnServerClosed();
|
||||
m_parent->OnServerClosed();
|
||||
}
|
||||
|
||||
void KLightServerSession::OnClientClosed() {
|
||||
|
@ -36,14 +36,14 @@ namespace ams::kern {
|
|||
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());
|
||||
|
||||
/* Check that the server isn't closed. */
|
||||
R_UNLESS(!this->parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!m_parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
|
||||
/* Try to sleep the thread. */
|
||||
R_UNLESS(this->request_queue.SleepThread(request_thread), svc::ResultTerminationRequested());
|
||||
R_UNLESS(m_request_queue.SleepThread(request_thread), svc::ResultTerminationRequested());
|
||||
|
||||
/* If we don't have a current request, wake up a server thread to handle it. */
|
||||
if (this->current_request == nullptr) {
|
||||
this->server_queue.WakeupFrontThread();
|
||||
if (m_current_request == nullptr) {
|
||||
m_server_queue.WakeupFrontThread();
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
|
@ -62,27 +62,27 @@ namespace ams::kern {
|
|||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Check that we're open. */
|
||||
R_UNLESS(!this->parent->IsClientClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!this->parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!m_parent->IsClientClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!m_parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
|
||||
/* Check that we have a request to reply to. */
|
||||
R_UNLESS(this->current_request != nullptr, svc::ResultInvalidState());
|
||||
R_UNLESS(m_current_request != nullptr, svc::ResultInvalidState());
|
||||
|
||||
/* Check that the server thread is correct. */
|
||||
R_UNLESS(this->server_thread == server_thread, svc::ResultInvalidState());
|
||||
R_UNLESS(m_server_thread == server_thread, svc::ResultInvalidState());
|
||||
|
||||
/* If we can reply, do so. */
|
||||
if (!this->current_request->IsTerminationRequested()) {
|
||||
MESOSPHERE_ASSERT(this->current_request->GetState() == KThread::ThreadState_Waiting);
|
||||
MESOSPHERE_ASSERT(this->request_queue.begin() != this->request_queue.end() && this->current_request == std::addressof(*this->request_queue.begin()));
|
||||
std::memcpy(this->current_request->GetLightSessionData(), server_thread->GetLightSessionData(), KLightSession::DataSize);
|
||||
this->request_queue.WakeupThread(this->current_request);
|
||||
if (!m_current_request->IsTerminationRequested()) {
|
||||
MESOSPHERE_ASSERT(m_current_request->GetState() == KThread::ThreadState_Waiting);
|
||||
MESOSPHERE_ASSERT(m_request_queue.begin() != m_request_queue.end() && m_current_request == std::addressof(*m_request_queue.begin()));
|
||||
std::memcpy(m_current_request->GetLightSessionData(), server_thread->GetLightSessionData(), KLightSession::DataSize);
|
||||
m_request_queue.WakeupThread(m_current_request);
|
||||
}
|
||||
|
||||
/* Clear our current request. */
|
||||
cur_request = this->current_request;
|
||||
this->current_request = nullptr;
|
||||
this->server_thread = nullptr;
|
||||
cur_request = m_current_request;
|
||||
m_current_request = nullptr;
|
||||
m_server_thread = nullptr;
|
||||
}
|
||||
|
||||
/* Close the current request, if we had one. */
|
||||
|
@ -96,8 +96,8 @@ namespace ams::kern {
|
|||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Check that we aren't already receiving. */
|
||||
R_UNLESS(this->server_queue.IsEmpty(), svc::ResultInvalidState());
|
||||
R_UNLESS(this->server_thread == nullptr, svc::ResultInvalidState());
|
||||
R_UNLESS(m_server_queue.IsEmpty(), svc::ResultInvalidState());
|
||||
R_UNLESS(m_server_thread == nullptr, svc::ResultInvalidState());
|
||||
|
||||
/* If we cancelled in a previous loop, clear cancel state. */
|
||||
if (set_cancellable) {
|
||||
|
@ -106,22 +106,22 @@ namespace ams::kern {
|
|||
}
|
||||
|
||||
/* Check that we're open. */
|
||||
R_UNLESS(!this->parent->IsClientClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!this->parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!m_parent->IsClientClosed(), svc::ResultSessionClosed());
|
||||
R_UNLESS(!m_parent->IsServerClosed(), svc::ResultSessionClosed());
|
||||
|
||||
/* If we have a request available, use it. */
|
||||
if (this->current_request == nullptr && !this->request_queue.IsEmpty()) {
|
||||
this->current_request = std::addressof(*this->request_queue.begin());
|
||||
this->current_request->Open();
|
||||
this->server_thread = server_thread;
|
||||
if (m_current_request == nullptr && !m_request_queue.IsEmpty()) {
|
||||
m_current_request = std::addressof(*m_request_queue.begin());
|
||||
m_current_request->Open();
|
||||
m_server_thread = server_thread;
|
||||
break;
|
||||
} else {
|
||||
/* Otherwise, wait for a request to come in. */
|
||||
R_UNLESS(this->server_queue.SleepThread(server_thread), svc::ResultTerminationRequested());
|
||||
R_UNLESS(m_server_queue.SleepThread(server_thread), svc::ResultTerminationRequested());
|
||||
|
||||
/* Check if we were cancelled. */
|
||||
if (server_thread->IsWaitCancelled()) {
|
||||
this->server_queue.WakeupThread(server_thread);
|
||||
m_server_queue.WakeupThread(server_thread);
|
||||
server_thread->ClearWaitCancelled();
|
||||
return svc::ResultCancelled();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace ams::kern {
|
|||
}
|
||||
|
||||
/* Copy the client data. */
|
||||
std::memcpy(server_thread->GetLightSessionData(), this->current_request->GetLightSessionData(), KLightSession::DataSize);
|
||||
std::memcpy(server_thread->GetLightSessionData(), m_current_request->GetLightSessionData(), KLightSession::DataSize);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -144,30 +144,30 @@ namespace ams::kern {
|
|||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Handle the current request. */
|
||||
if (this->current_request != nullptr) {
|
||||
if (m_current_request != nullptr) {
|
||||
/* Reply to the current request. */
|
||||
if (!this->current_request->IsTerminationRequested()) {
|
||||
MESOSPHERE_ASSERT(this->current_request->GetState() == KThread::ThreadState_Waiting);
|
||||
MESOSPHERE_ASSERT(this->request_queue.begin() != this->request_queue.end() && this->current_request == std::addressof(*this->request_queue.begin()));
|
||||
this->request_queue.WakeupThread(this->current_request);
|
||||
this->current_request->SetSyncedObject(nullptr, svc::ResultSessionClosed());
|
||||
if (!m_current_request->IsTerminationRequested()) {
|
||||
MESOSPHERE_ASSERT(m_current_request->GetState() == KThread::ThreadState_Waiting);
|
||||
MESOSPHERE_ASSERT(m_request_queue.begin() != m_request_queue.end() && m_current_request == std::addressof(*m_request_queue.begin()));
|
||||
m_request_queue.WakeupThread(m_current_request);
|
||||
m_current_request->SetSyncedObject(nullptr, svc::ResultSessionClosed());
|
||||
}
|
||||
|
||||
/* Clear our current request. */
|
||||
cur_request = this->current_request;
|
||||
this->current_request = nullptr;
|
||||
this->server_thread = nullptr;
|
||||
cur_request = m_current_request;
|
||||
m_current_request = nullptr;
|
||||
m_server_thread = nullptr;
|
||||
}
|
||||
|
||||
/* Reply to all other requests. */
|
||||
while (!this->request_queue.IsEmpty()) {
|
||||
KThread *client_thread = this->request_queue.WakeupFrontThread();
|
||||
while (!m_request_queue.IsEmpty()) {
|
||||
KThread *client_thread = m_request_queue.WakeupFrontThread();
|
||||
client_thread->SetSyncedObject(nullptr, svc::ResultSessionClosed());
|
||||
}
|
||||
|
||||
/* Wake up all server threads. */
|
||||
while (!this->server_queue.IsEmpty()) {
|
||||
this->server_queue.WakeupFrontThread();
|
||||
while (!m_server_queue.IsEmpty()) {
|
||||
m_server_queue.WakeupFrontThread();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue