Files
rust/library/std/src
Jonathan Brouwer 815492b62e Rollup merge of #160219 - valentynkit:thread-os-id, r=nia-e
Implement `Thread::os_id`

Implements `Thread::os_id` as an unstable feature, per the accepted ACP rust-lang/libs-team#635.

Tracking issue: rust-lang/rust#160215

`os_id` returns the OS-level thread id, so Rust programs can tie their own logs to system-level logs (the ACP's stated motivation).

- Using the existing `current_os_id` is much simpler than pulling the id off `imp::Thread` in `spawn_unchecked`. That needs a per-platform arm, and the child still has to fill it in on platforms without a by handle query, so it'd be extra on top of this rather than instead of it.
- `Thread` is handed to user code by spawn hooks before the native thread exists, so the id can only be filled in later. There's no spare `u64` value to mean "not set yet", so a OnceLock is chosen as a simple primitive to use for this purpose.

r? libs
2026-09-08 23:32:14 +02:00
..
2026-09-01 08:57:20 -05:00
2026-05-31 06:58:19 -07:00
2026-08-28 19:38:03 +02:00
2026-07-13 10:54:53 +02:00
2026-08-09 17:37:43 +02:00
…
…
2026-07-13 18:04:39 -04:00
2026-08-12 19:11:34 +00:00
2026-08-25 18:15:10 +00:00
…
2026-09-01 08:57:20 -05:00
2026-08-24 19:04:01 +02:00
2026-07-25 19:11:28 +02:00