Function spawn

Source
pub fn spawn<F, T>(
    scheduler: Scheduler,
    params: impl IntoSchedParams,
    f: F,
) -> JoinHandle<T>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Spawn a thread with the provided scheduler and params.

Params can either be a SchedParams struct, or an i32 representing the desired priority. This function validates that the priority is between min and max for the scheduler before attempting to set it. It panics if the priority is outside the allowed range or setting the scheduler returns an error code.