blob: 6a93b78d3b4dc792dad0cb641fa9562bc5355f08 [file] [log] [blame]
use std::thread::{Builder, JoinHandle};
/// Like `thread::spawn`, but with a `name` argument.
pub fn spawn_named<F, T, S>(name: S, f: F) -> JoinHandle<T>
where
F: FnOnce() -> T + Send + 'static,
T: Send + 'static,
S: Into<String>,
{
Builder::new().name(name.into()).spawn(f).expect("thread spawn works")
}