forked from Bananymous/banan-os
Kernel: init2 is now launched as a process instead of thread
Also only process can now add threads to scheduler. Nobody should have raw access to scheduler and everything should be through Process::current() or irqs (reschedules)
This commit is contained in:
parent
7bd4593748
commit
59a682c720
|
@ -17,8 +17,6 @@ namespace Kernel
|
||||||
void reschedule();
|
void reschedule();
|
||||||
void reschedule_if_idling();
|
void reschedule_if_idling();
|
||||||
|
|
||||||
BAN::ErrorOr<void> add_thread(Thread*);
|
|
||||||
|
|
||||||
void set_current_thread_sleeping(uint64_t);
|
void set_current_thread_sleeping(uint64_t);
|
||||||
[[noreturn]] void set_current_thread_done();
|
[[noreturn]] void set_current_thread_done();
|
||||||
|
|
||||||
|
@ -38,6 +36,8 @@ namespace Kernel
|
||||||
void advance_current_thread();
|
void advance_current_thread();
|
||||||
[[noreturn]] void execute_current_thread();
|
[[noreturn]] void execute_current_thread();
|
||||||
|
|
||||||
|
BAN::ErrorOr<void> add_thread(Thread*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ActiveThread
|
struct ActiveThread
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,8 @@ namespace Kernel
|
||||||
BAN::LinkedList<ActiveThread>::iterator m_current_thread;
|
BAN::LinkedList<ActiveThread>::iterator m_current_thread;
|
||||||
|
|
||||||
uint64_t m_last_reschedule = 0;
|
uint64_t m_last_reschedule = 0;
|
||||||
|
|
||||||
|
friend class Process;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -165,9 +165,9 @@ extern "C" void kernel_main()
|
||||||
|
|
||||||
MUST(Scheduler::initialize());
|
MUST(Scheduler::initialize());
|
||||||
Scheduler& scheduler = Scheduler::get();
|
Scheduler& scheduler = Scheduler::get();
|
||||||
MUST(scheduler.add_thread(MUST(Thread::create(init2, tty1, nullptr))));
|
MUST(Process::create_kernel(init2, tty1));
|
||||||
scheduler.start();
|
scheduler.start();
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue