@@ -40,8 +40,13 @@ cfg_if::cfg_if! {
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | | -/// This module maintains a list of TLS destructors for the current thread, |
44 | | -/// all of which will be run on thread exit. |
| 43 | +/// The native TLS implementation needs a way to register destructors for its data. |
| 44 | +/// This module contains platform-specific implementations of that register. |
| 45 | +/// |
| 46 | +/// It turns out however that most platforms don't have a way to register a |
| 47 | +/// destructor for each variable. On these platforms, we keep track of the |
| 48 | +/// destructors ourselves and register (through the [`guard`] module) only a |
| 49 | +/// single callback that runs all of the destructors in the list. |
45 | 50 | #[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))] |
46 | 51 | pub(crate) mod destructors { |
47 | 52 | cfg_if::cfg_if! { |
@@ -91,7 +96,12 @@ mod guard {
|
91 | 96 | } |
92 | 97 | } |
93 | 98 | |
94 | | -/// This module provides the `StaticKey` abstraction over OS TLS keys. |
| 99 | +/// `const`-creatable TLS keys. |
| 100 | +/// |
| 101 | +/// Most OSs without native TLS will provide a library-based way to create TLS |
| 102 | +/// storage. For each TLS variable, we create a key, which can then be used to |
| 103 | +/// reference an entry in a thread-local table. This then associates each key |
| 104 | +/// with a pointer which we can get and set to store our data. |
95 | 105 | pub(crate) mod key { |
96 | 106 | cfg_if::cfg_if! { |
97 | 107 | if #[cfg(any( |
|