Kernel: Create CriticalScope and fix kmalloc
This disables interrupts for the current scope and restores them after the scope. This is used in kmalloc, since scheduler might call into kmalloc/kfree, but deadlock if some thread is currently trying to allocate. This allows us to use kmalloc in Scheduler.
This commit is contained in:
@@ -103,7 +103,6 @@ extern "C" void kernel_main()
|
||||
|
||||
MUST(Scheduler::initialize());
|
||||
Scheduler& scheduler = Scheduler::get();
|
||||
#if 1
|
||||
MUST(scheduler.add_thread(MUST(Thread::create(
|
||||
[terminal_driver]
|
||||
{
|
||||
@@ -120,7 +119,6 @@ extern "C" void kernel_main()
|
||||
terminal_driver->set_font(font_or_error.release_value());
|
||||
}
|
||||
))));
|
||||
#endif
|
||||
MUST(scheduler.add_thread(MUST(Thread::create(
|
||||
[tty1]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user