[][src]Function cortexm_threads::create_thread

pub fn create_thread(stack: &mut [u32], handler_fn: fn() -> !) -> Result<(), u8>

Create a thread with default configuration (lowest priority, unprivileged).

Arguments

  • stack: mut array of u32's to be used as stack area
  • handler_fn: function to execute in created thread

Example

let mut stack1 = [0xDEADBEEF; 512];
let _ = create_thread(
    &mut stack1,
    || {
        loop {
            let _ = hprintln!("in task 1 !!");
            sleep(50);
        }
    });