We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 619163e commit d5e0eafCopy full SHA for d5e0eaf
library/std/src/sys_common/thread_info.rs
@@ -34,7 +34,9 @@ impl ThreadInfo {
34
///
35
/// This can be used as a non-null usize-sized ID.
36
pub fn current_thread_unique_ptr() -> usize {
37
- THREAD_INFO.with(|info| <*const _>::addr(info))
+ // Use a non-drop type to make sure it's still available during thread destruction.
38
+ thread_local! { static X: u8 = 0 }
39
+ X.with(|x| <*const _>::addr(x))
40
}
41
42
pub fn current_thread() -> Option<Thread> {
0 commit comments