Skip to main content

osiris/
idle.rs

1use crate::hal;
2use crate::sched;
3
4extern "C" fn entry(_ctx: *mut core::ffi::c_void) {
5    loop {
6        hal::asm::nop!();
7    }
8}
9
10pub fn init() {
11    let attrs = sched::thread::Attributes {
12        entry,
13        ctx: core::ptr::null_mut(),
14        fin: None,
15        attrs: None,
16    };
17    sched::with(|sched| {
18        if let Err(e) = sched.create_thread(Some(sched::task::KERNEL_TASK), &attrs) {
19            panic!("failed to create idle thread. Error: {}", e);
20        }
21    });
22}