mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
kern: split Process/Thread exit to separate WorkerTaskManagers
This commit is contained in:
parent
4ddfb6183c
commit
f93aea4c06
4 changed files with 15 additions and 10 deletions
|
@ -25,7 +25,8 @@ namespace ams::kern {
|
||||||
static constexpr s32 ExitWorkerPriority = 11;
|
static constexpr s32 ExitWorkerPriority = 11;
|
||||||
|
|
||||||
enum WorkerType {
|
enum WorkerType {
|
||||||
WorkerType_Exit,
|
WorkerType_ExitThread,
|
||||||
|
WorkerType_ExitProcess,
|
||||||
|
|
||||||
WorkerType_Count,
|
WorkerType_Count,
|
||||||
};
|
};
|
||||||
|
|
|
@ -491,7 +491,7 @@ namespace ams::kern {
|
||||||
MESOSPHERE_LOG("KProcess::Exit() pid=%ld name=%-12s\n", m_process_id, m_name);
|
MESOSPHERE_LOG("KProcess::Exit() pid=%ld name=%-12s\n", m_process_id, m_name);
|
||||||
|
|
||||||
/* Register the process as a work task. */
|
/* Register the process as a work task. */
|
||||||
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_Exit, this);
|
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_ExitProcess, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exit the current thread. */
|
/* Exit the current thread. */
|
||||||
|
@ -536,7 +536,7 @@ namespace ams::kern {
|
||||||
MESOSPHERE_LOG("KProcess::Terminate() FAIL pid=%ld name=%-12s\n", m_process_id, m_name);
|
MESOSPHERE_LOG("KProcess::Terminate() FAIL pid=%ld name=%-12s\n", m_process_id, m_name);
|
||||||
|
|
||||||
/* Register the process as a work task. */
|
/* Register the process as a work task. */
|
||||||
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_Exit, this);
|
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_ExitProcess, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -476,10 +476,6 @@ namespace ams::kern {
|
||||||
m_parent->ClearRunningThread(this);
|
m_parent->ClearRunningThread(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signal. */
|
|
||||||
m_signaled = true;
|
|
||||||
KSynchronizationObject::NotifyAvailable();
|
|
||||||
|
|
||||||
/* Call the on thread termination handler. */
|
/* Call the on thread termination handler. */
|
||||||
KThreadContext::OnThreadTerminating(this);
|
KThreadContext::OnThreadTerminating(this);
|
||||||
|
|
||||||
|
@ -507,6 +503,13 @@ namespace ams::kern {
|
||||||
cpu::SynchronizeCores(m_parent->GetPhysicalCoreMask());
|
cpu::SynchronizeCores(m_parent->GetPhysicalCoreMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Acquire the scheduler lock. */
|
||||||
|
KScopedSchedulerLock sl;
|
||||||
|
|
||||||
|
/* Signal. */
|
||||||
|
m_signaled = true;
|
||||||
|
KSynchronizationObject::NotifyAvailable();
|
||||||
|
|
||||||
/* Close the thread. */
|
/* Close the thread. */
|
||||||
this->Close();
|
this->Close();
|
||||||
}
|
}
|
||||||
|
@ -1328,7 +1331,7 @@ namespace ams::kern {
|
||||||
this->StartTermination();
|
this->StartTermination();
|
||||||
|
|
||||||
/* Register the thread as a work task. */
|
/* Register the thread as a work task. */
|
||||||
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_Exit, this);
|
KWorkerTaskManager::AddTask(KWorkerTaskManager::WorkerType_ExitThread, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MESOSPHERE_PANIC("KThread::Exit() would return");
|
MESOSPHERE_PANIC("KThread::Exit() would return");
|
||||||
|
|
|
@ -115,8 +115,9 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* Perform more core-0 specific initialization. */
|
/* Perform more core-0 specific initialization. */
|
||||||
if (core_id == 0) {
|
if (core_id == 0) {
|
||||||
/* Initialize the exit worker manager, so that threads and processes may exit cleanly. */
|
/* Initialize the exit worker managers, so that threads and processes may exit cleanly. */
|
||||||
Kernel::GetWorkerTaskManager(KWorkerTaskManager::WorkerType_Exit).Initialize(KWorkerTaskManager::ExitWorkerPriority);
|
Kernel::GetWorkerTaskManager(KWorkerTaskManager::WorkerType_ExitThread).Initialize(KWorkerTaskManager::ExitWorkerPriority);
|
||||||
|
Kernel::GetWorkerTaskManager(KWorkerTaskManager::WorkerType_ExitProcess).Initialize(KWorkerTaskManager::ExitWorkerPriority);
|
||||||
|
|
||||||
/* Setup so that we may sleep later, and reserve memory for secure applets. */
|
/* Setup so that we may sleep later, and reserve memory for secure applets. */
|
||||||
KSystemControl::InitializePhase2();
|
KSystemControl::InitializePhase2();
|
||||||
|
|
Loading…
Reference in a new issue