Add a ProcessManager class to store Process objects.

Trying out a new method for exposing global objects directly via a
variable.
This commit is contained in:
Drew Galbraith 2023-05-29 23:35:44 -07:00
parent b58186265e
commit 7fe6c24aa5
7 changed files with 66 additions and 23 deletions

View file

@ -0,0 +1,23 @@
#pragma once
#include "lib/linked_list.h"
#include "lib/shared_ptr.h"
#include "scheduler/process.h"
class ProcessManager {
public:
// Initializes the ProcessManager
// and stores it in the global variable.
static void Init();
void InsertProcess(const SharedPtr<Process>& proc);
Process& FromId(uint64_t id);
void DumpProcessStates();
private:
// TODO: This should be a hashmap.
LinkedList<SharedPtr<Process>> proc_list_;
};
extern ProcessManager* gProcMan;