pub fn spawn<F, T>(priority: ThreadPriority, f: F) -> JoinHandle<T> where
    F: FnOnce(Result<(), Error>) -> T,
    F: Send + 'static,
    T: Send + 'static, 
Expand description

Spawns a thread with the specified priority.

See ThreadBuilderExt::spawn_with_priority.

use thread_priority::*;

let thread = spawn(ThreadPriority::Max, |result| {
    // This is printed out from within the spawned thread.
    println!("Set priority result: {:?}", result);
    assert!(result.is_ok());
});
thread.join();