pub(crate) fn current_os_id() -> u64
Expand description
Gets the OS thread ID of the thread that invokes it, if available. If not, return the Rust thread ID.
We use a u64
to all possible platform IDs without excess cfg
; most use int
, some use a
pointer, and Apple uses uint64_t
. This is a “best effort” approach for diagnostics and is
allowed to fall back to a non-OS ID (such as the Rust thread ID) or a non-unique ID (such as a
PID) if the thread ID cannot be retrieved.