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

@ -48,7 +48,7 @@ void Scheduler::Preempt() {
return;
}
SharedPtr<Thread> prev = current_thread_;
RefPtr<Thread> prev = current_thread_;
prev->SetState(Thread::RUNNABLE);
current_thread_ = runnable_threads_.CycleFront(prev);
@ -62,7 +62,7 @@ void Scheduler::Yield() {
}
asm volatile("cli");
SharedPtr<Thread> prev = current_thread_;
RefPtr<Thread> prev = current_thread_;
if (prev == sleep_thread_) {
if (runnable_threads_.size() == 0) {
panic("Sleep thread yielded without next.");