about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2016-10-04 18:00:27 +0000
committerBrian Anderson <banderson@mozilla.com>2016-11-01 17:08:24 +0000
commit8b2600dbf9a02a19acc92db5d980986cad2ea38d (patch)
treeaa251881190afa9446c09261436df38c6196432e /src/libstd/thread
parent568840707cd5f98a1970a44d632b833439d5312e (diff)
downloadrust-8b2600dbf9a02a19acc92db5d980986cad2ea38d.tar.gz
rust-8b2600dbf9a02a19acc92db5d980986cad2ea38d.zip
Document reasoning for supporting both fast and OS TLS in the same bin
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 4c3980b3c7b..255cd2a9bc0 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -181,6 +181,15 @@ use time::Duration;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::local::{LocalKey, LocalKeyState};
 
+// 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
+// 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.
+
 #[unstable(feature = "libstd_thread_internals", issue = "0")]
 #[cfg(target_thread_local)]
 #[doc(hidden)] pub use sys::fast_thread_local::Key as __FastLocalKeyInner;