-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Tracking Issue for thread_os_id #160215
Copy link
Copy link
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Feature gate:
#![feature(thread_os_id)]This is a tracking issue for
Thread::os_id, which returns the OS-level thread id of the thread a handle refers to. That is the id that shows up in tools likepsandtop, debuggers, and crash logs.ThreadIdis under the control of the standard library and has no guaranteed relationship to it, so the two cannot be used interchangeably.Public API
Nonemeans the platform has no OS thread id, or has no way to read it, or the handle belongs to a spawned thread that has not started running yet. That last case is not one of the reasons the ACP gave, so it is an unresolved question below.Steps / History
Thread::os_idlibs-team#635Thread::os_id#160219Unresolved Questions
os_idreturnsNone. The ACP describesNoneas meaning "the platform does not support it", so this is an extra reason a caller can see it. As far as I can tell that is fine for an unstable feature, but worth confirming before stabilization.thread::current_os_idunder alternatives, and the question of why that would be "more limited", given that "having to load aThreadis unnecessarily inefficient on platforms where the thread ID can be fetched directly", was left unanswered.std::threaddoes have an internalcurrent_os_id, but it returnsu64and falls back to the Rust thread id, so it is not the shape a public function would want. Out of scope here either way, but still open.thread::current_os_idcan be useful but is less flexible, so we can consider it separately.Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩