pub fn create_thread_with_config(
stack: &mut [u32],
handler_fn: fn() -> !,
priority: u8,
priviliged: bool,
) -> Result<(), u8>
Expand description
Create a thread with explicit configuration
§Arguments
- stack: mut array of u32’s to be used as stack area
- handler_fn: function to execute in created thread
- priority: higher numeric value means higher priority
- privileged: run thread in privileged mode
§Example
let mut stack1 = [0xDEADBEEF; 512];
let _ = create_thread_with_config(
&mut stack1,
|| {
loop {
let _ = hprintln!("in task 1 !!");
sleep(50);
}
},
0xff, // priority, this is the maximum, higher number means higher priority
true // this thread will be run in privileged mode
);
FIXME: take stack memory as a vec (arrayvec?, smallvec?) instead of &[]