Implement an executor with waker support

This commit is contained in:
Philipp Oppermann
2020-03-27 17:01:09 +01:00
parent d7b144364d
commit 50b4b89ac2
4 changed files with 112 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
extern crate alloc;
use blog_os::println;
use blog_os::task::{keyboard, simple_executor::SimpleExecutor, Task};
use blog_os::task::{executor::Executor, keyboard, Task};
use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo;
@@ -27,16 +27,13 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
allocator::init_heap(&mut mapper, &mut frame_allocator).expect("heap initialization failed");
let mut executor = SimpleExecutor::new();
executor.spawn(Task::new(example_task()));
executor.spawn(Task::new(keyboard::print_keypresses()));
executor.run();
#[cfg(test)]
test_main();
println!("It did not crash!");
blog_os::hlt_loop();
let mut executor = Executor::new();
executor.spawn(Task::new(example_task()));
executor.spawn(Task::new(keyboard::print_keypresses()));
executor.run();
}
/// This function is called on panic.