Skip to main content

spawn_ptask

Macro spawn_ptask 

Source
macro_rules! spawn_ptask {
    (stack = $stack_size:expr, priority = $prio:expr, entry = $entry:expr, arg = $arg:expr) => { ... };
}
Expand description

Declare and spawn a preemptive task in one step.

static CONFIG: MyConfig = MyConfig { ... };

rivet::spawn_ptask!(stack = 2048, priority = 3, entry = my_task, arg = CONFIG);

fn my_task(cfg: &'static MyConfig) -> ! {
    loop { /* runs with real preemption, own stack */ }
}