gecko-dev/third_party/rust/thread-id
Servo VCS Sync be92d942e5 No bug - Revendor rust dependencies 2017-10-24 17:55:24 +00:00
..
src Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
.appveyor.yml Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
.cargo-checksum.json No bug - Revendor rust dependencies 2017-10-24 17:55:24 +00:00
.travis.yml Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
Cargo.toml Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
changelog.md Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
license-apache Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
license-mit Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00
readme.md Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink 2017-09-05 09:26:22 -07:00

readme.md

Thread-ID

Get a unique ID for the current thread in Rust.

Build Status Build Status Crates.io version Documentation

For diagnostics and debugging it can often be useful to get an ID that is different for every thread. Until Rust 1.14, the standard library did not expose a way to do that, hence this crate.

Example

use std::thread;
use thread_id;

thread::spawn(move || {
    println!("spawned thread has id {}", thread_id::get());
});

println!("main thread has id {}", thread_id::get());

This will print two different numbers.

License

Thread-ID is licensed under either the Apache 2.0 license, or the MIT license, at your option. It may be used in free software as well as closed-source applications, both for commercial and non-commercial use under the conditions given in the license.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache 2.0 license, shall be dual licensed as above, without any additional terms or conditions.