kernel/uspace/util.rs
1//! This module provides utility functions to declare and create tasks.
2
3use crate::sched;
4
5/// Declare a task with the given memory size, stack size, and name.
6#[macro_export]
7macro_rules! DECLARE_TASK {
8 (mem_size: $mem_size:expr, stack_size: $stack_size:expr, name: $name:ident) => {
9 const TASK_ # # $name # # _MEM_SIZE: usize = $mem_size;
10 const TASK_ # # $name # # _STACK_SIZE: usize = $stack_size;
11 };
12}
13
14/// A task finalizer which can be called when a task is finished, it will perform a reschedule.
15pub extern "C" fn thread_finalizer() {
16 //let _ = hal::hprintln!("debug: thread finalizer called.");
17
18 sched::reschedule();
19}