thread_priority

Function spawn_careless

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

Spawns a thread with the specified priority. This is different from spawn in a way that the passed function doesn’t need to accept the ThreadPriority::set_for_current result. In case of an error, the error is logged using the logging facilities.

See spawn.

use thread_priority::*;

let thread = spawn_careless(ThreadPriority::Max, || {
    // This is printed out from within the spawned thread.
    println!("We don't care about the priority result.");
});
thread.join();