Create a RefCounted type and use it for Thread.

This should prevent me from actually creating 2 shared ptrs of
a single kernel object with their separate ref counts.
This commit is contained in:
Drew Galbraith 2023-06-06 19:05:03 -07:00
parent d9b17d96d7
commit 2e1357255c
8 changed files with 146 additions and 22 deletions

View file

@ -20,8 +20,12 @@ extern "C" void thread_init() {
} // namespace
SharedPtr<Thread> Thread::RootThread(Process& root_proc) {
return new Thread(root_proc);
RefPtr<Thread> Thread::RootThread(Process& root_proc) {
return MakeRefCounted<Thread>(root_proc);
}
RefPtr<Thread> Thread::Create(Process& proc, uint64_t tid) {
return MakeRefCounted<Thread>(proc, tid);
}
Thread::Thread(Process& proc, uint64_t tid) : process_(proc), id_(tid) {