diff options
author | Joe Wilm <joe@jwilm.com> | 2016-06-07 21:11:23 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-06-07 21:11:23 -0700 |
commit | 06451fbab1b59116c8e0634472fb9e35fdaee48e (patch) | |
tree | 85b26f640f868068c57989d492b50e59c360e599 /src/util.rs | |
parent | 5e920b893a2d9012b49d266d1cc7944bb11d1bcc (diff) | |
download | alacritty-06451fbab1b59116c8e0634472fb9e35fdaee48e.tar.gz alacritty-06451fbab1b59116c8e0634472fb9e35fdaee48e.zip |
Add named thread for pty reader
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 00000000..0a3de227 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,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") + } +} |