about summary refs log tree commit diff
path: root/library/std/src/sys/thread_local/key
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2024-06-17 15:58:06 +0200
committerjoboet <jonasboettiger@icloud.com>2024-06-17 15:58:06 +0200
commit35f050b8dafc19233f4ecfabd1ac4aa117a491b9 (patch)
treeab4a182fc77a4558c3cb43602a2cbd353219cc94 /library/std/src/sys/thread_local/key
parentb2f29edc81a20f016e8b5d7197c9753c6446e399 (diff)
downloadrust-35f050b8dafc19233f4ecfabd1ac4aa117a491b9.tar.gz
rust-35f050b8dafc19233f4ecfabd1ac4aa117a491b9.zip
std: update TLS module documentation
Diffstat (limited to 'library/std/src/sys/thread_local/key')
-rw-r--r--library/std/src/sys/thread_local/key/racy.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/library/std/src/sys/thread_local/key/racy.rs b/library/std/src/sys/thread_local/key/racy.rs
index e2eaca197d4..eda8b83bc7f 100644
--- a/library/std/src/sys/thread_local/key/racy.rs
+++ b/library/std/src/sys/thread_local/key/racy.rs
@@ -1,14 +1,10 @@
-//! An implementation of `const`-creatable TLS keys for non-Windows platforms.
+//! A `StaticKey` implementation using racy initialization.
 //!
-//! Most OSs without native TLS will provide a library-based way to create TLS
-//! storage. For each TLS variable, we create a key, which can then be used to
-//! reference an entry in a thread-local table. This then associates each key
-//! with a pointer which we can get and set to store our data.
-//!
-//! Unfortunately, none of these platforms allows creating the key at compile-time,
-//! which means we need a way to lazily create keys (`StaticKey`). Instead of
-//! blocking API like `OnceLock`, we use racy initialization, which should be
-//! more lightweight and avoids circular dependencies with the rest of `std`.
+//! Unfortunately, none of the platforms currently supported by `std` allows
+//! creating TLS keys at compile-time. Thus we need a way to lazily create keys.
+//! Instead of blocking API like `OnceLock`, we use racy initialization, which
+//! should be more lightweight and avoids circular dependencies with the rest of
+//! `std`.
 
 use crate::sync::atomic::{self, AtomicUsize, Ordering};