gecko-dev/third_party/rust/thread-id
Kartikaya Gupta 47c3dd535d Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj
MozReview-Commit-ID: LQicTh0fmk0

--HG--
extra : rebase_source : 7a5ee9c3242fefa72e8d0372b8e9c03170c7df4b
2017-06-20 16:05:17 -04:00
..
src
.appveyor.yml
.cargo-checksum.json
.cargo-ok
.travis.yml
Cargo.toml
license
readme.md

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 the Apache 2.0 license. 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. If you want to use Thread-ID in your GPLv2-licensed software, you can add an exception to your copyright notice.