[Zion] Move existing proc/thread cleanup calls to the cleanup thread.

This commit is contained in:
Drew Galbraith 2023-11-24 15:39:43 -08:00
parent 8bedc80caf
commit 8fb5b7c03c
6 changed files with 67 additions and 34 deletions

View file

@ -31,6 +31,7 @@ class Process : public KernelObject {
UNSPECIFIED,
SETUP,
RUNNING,
CLEANUP,
FINISHED,
};
static glcr::RefPtr<Process> RootProcess();
@ -55,14 +56,16 @@ class Process : public KernelObject {
}
uint64_t AddExistingCapability(const glcr::RefPtr<Capability>& cap);
// Checks the state of all child threads and transitions to
// finished if all have finished.
void CheckState();
State GetState() { return state_; }
// This stops all of the processes threads (they will no longer be scheduled)
// and flags the process for cleanup.
void Exit();
// This *should not* be called from a thread that belongs to this process.
// Rather it should be called from the cleanup thread.
void Cleanup();
private:
friend class glcr::MakeRefCountedFriend<Process>;
Process();