[Zion] Add a proc/thread cleanup thread for future use.

This commit is contained in:
Drew Galbraith 2023-11-24 15:04:03 -08:00
parent 8e4cd1562f
commit cb590c96b8
9 changed files with 95 additions and 0 deletions

25
zion/scheduler/cleanup.h Normal file
View file

@ -0,0 +1,25 @@
#pragma once
#include <glacier/container/linked_list.h>
#include <glacier/memory/ref_ptr.h>
#include "object/process.h"
#include "object/semaphore.h"
#include "object/thread.h"
class ProcessCleanup {
public:
ProcessCleanup() {}
void CleanupLoop();
void CleanupProcess(glcr::RefPtr<Process> process);
void CleanupThread(glcr::RefPtr<Thread> thread);
private:
Semaphore semaphore_;
glcr::LinkedList<glcr::RefPtr<Thread>> thread_list_;
glcr::LinkedList<glcr::RefPtr<Process>> process_list_;
};
void CleanupThreadEntry(ProcessCleanup* cleanup);