aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/thread.rs
blob: 6a93b78d3b4dc792dad0cb641fa9562bc5355f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
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")
}