1
0
Fork
You've already forked thread-id
0
Get a unique thread ID in Rust https://github.com/ruuda/thread-id
  • Rust 100%
Find a file
Ruud van Asseldonk d748920c95 Move Windows CI from AppVeyor to GitHub Actions
On AppVeyor, Rust 1.60 still works fine, but 1.70 and later fail with an
SSL error:
 spurious network error (3 tries remaining): [35] SSL connect
 error (schannel: next InitializeSecurityContext failed:
 SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when
 a fatal SSL/TLS alert is received (e.g. handshake failed). More
 detail may be available in the Windows System event log.)
There is some more discussion in this thread:
 https://github.com/rust-lang/cargo/issues/12296
Which suggests it was due to some webserver configuration for crates.io,
but it seems that the TLS implementation used by Rust also plays a role.
Anyway, I haven't used Windows for almost a decade, I don't really feel
like debugging this. But GitHub Actions has runners, maybe it's easy to
migrate? And it turns out, yes that was pretty easy. We do lose the GNU
i868 configuration, but it's 2026, I wouldn't feel bad about stopping to
support i868 at this point. And the code of the crate is not even
changing so it probably still works anyway, right? ... right?
2026年01月10日 22:12:15 +01:00
.github/workflows Move Windows CI from AppVeyor to GitHub Actions 2026年01月10日 22:12:15 +01:00
src Make import paths compatible with Rust 2021 2024年10月22日 19:58:25 +02:00
.gitignore Work around breaking change in libc crate 2017年12月09日 20:53:17 +01:00
build.rcl Move Windows CI from AppVeyor to GitHub Actions 2026年01月10日 22:12:15 +01:00
Cargo.lock Bump MSRV to 1.71, version to 5.1.0 2026年01月10日 21:08:47 +01:00
Cargo.toml Bump MSRV to 1.71, version to 5.1.0 2026年01月10日 21:08:47 +01:00
changelog.md Move Windows CI from AppVeyor to GitHub Actions 2026年01月10日 22:12:15 +01:00
contributing.md Ban the use of LLMs in the issue tracker 2025年12月03日 20:30:52 +01:00
license-apache Add the MIT license as an option 2017年05月13日 15:26:40 +02:00
license-mit Add the MIT license as an option 2017年05月13日 15:26:40 +02:00
readme.md Migrate CI to GitHub Actions 2023年05月15日 21:30:55 +02:00
rust-toolchain.toml Bump MSRV to 1.71, version to 5.1.0 2026年01月10日 21:08:47 +01:00

Thread-ID

Get a unique ID for the current thread in Rust.

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

usestd::thread;usethread_id;lethandle=thread::spawn(move||{println!("spawned thread has id {}",thread_id::get());});println!("main thread has id {}",thread_id::get());handle.join().unwrap();

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.