update and extend some comments, and cfg-out some unused code

This commit is contained in:
Ralf Jung 2022-08-06 13:04:22 -04:00
parent 138375a74c
commit d13699d0be
3 changed files with 12 additions and 7 deletions

View file

@ -192,14 +192,12 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::local::{AccessError, LocalKey};
// The types used by the thread_local! macro to access TLS keys. Note that there
// are two types, the "OS" type and the "fast" type. The OS thread local key
// type is accessed via platform-specific API calls and is slow, while the fast
// Select the type used by the thread_local! macro to access TLS keys. There
// are three types: "static", "fast", "OS". The "OS" thread local key
// type is accessed via platform-specific API calls and is slow, while the "fast"
// key type is accessed via code generated via LLVM, where TLS keys are set up
// by the elf linker. Note that the OS TLS type is always available: on macOS
// the standard library is compiled with support for older platform versions
// where fast TLS was not available; end-user code is compiled with fast TLS
// where available, but both are needed.
// by the elf linker. "static" is for single-threaded platforms where a global
// static is sufficient.
#[unstable(feature = "libstd_thread_internals", issue = "none")]
#[cfg(target_thread_local)]
@ -210,6 +208,7 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
#[cfg(target_thread_local)]
#[cfg(test)] // when building for tests, use real std's key
pub use realstd::thread::__FastLocalKeyInner;
#[unstable(feature = "libstd_thread_internals", issue = "none")]
#[cfg(target_thread_local)]
#[cfg(test)]
@ -217,6 +216,7 @@ pub use self::local::fast::Key as __FastLocalKeyInnerUnused; // we import this a
#[unstable(feature = "libstd_thread_internals", issue = "none")]
#[doc(hidden)]
#[cfg(not(target_thread_local))]
pub use self::local::os::Key as __OsLocalKeyInner;
#[unstable(feature = "libstd_thread_internals", issue = "none")]
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]