pub fn spawn<F, T>(priority: ThreadPriority, f: F) -> JoinHandle<T>
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();