Skip to content

Commit 8b2600d

Browse files
committed
Document reasoning for supporting both fast and OS TLS in the same bin
1 parent 5688407 commit 8b2600d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libstd/thread/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ use time::Duration;
181181
#[stable(feature = "rust1", since = "1.0.0")]
182182
pub use self::local::{LocalKey, LocalKeyState};
183183

184+
// The types used by the thread_local! macro to access TLS keys. Note that there
185+
// are two types, the "OS" type and the "fast" type. The OS thread local key
186+
// type is accessed via platform-specific API calls and is slow, while the fast
187+
// key type is accessed via code generated via LLVM, where TLS keys are set up
188+
// by the elf linker. Note that the OS TLS type is always available: on macOS
189+
// the standard library is compiled with support for older platform versions
190+
// where fast TLS was not available; end-user code is compiled with fast TLS
191+
// where available, but both are needed.
192+
184193
#[unstable(feature = "libstd_thread_internals", issue = "0")]
185194
#[cfg(target_thread_local)]
186195
#[doc(hidden)] pub use sys::fast_thread_local::Key as __FastLocalKeyInner;

0 commit comments

Comments
 (0)