aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
blob: 0a3de227d56a2fb11246c0413f1eb8aa36fbf0de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
/// Threading utilities
pub mod thread {
    /// Like `thread::spawn`, but with a `name` argument
    pub fn spawn_named<F, T, S>(name: S, f: F) -> ::std::thread::JoinHandle<T>
        where F: FnOnce() -> T,
              F: Send + 'static,
              T: Send + 'static,
              S: Into<String>
    {
        ::std::thread::Builder::new().name(name.into()).spawn(f).expect("thread spawn works")
    }
}