Function try_spawn

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

Spawn a thread and attempt to set the schedule of the current thread. The result of setting the scheduler is provided to the thread closure as an argument.

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. Failures will continue execution and pass through the Result to the thread closure.