Skip to content

Commit 6888fb1

Browse files
committed
Move current_thread_unique_ptr to the only module that uses it.
1 parent d5e0eaf commit 6888fb1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

library/std/src/sys/unix/locks/futex.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::sync::atomic::{
44
Ordering::{Acquire, Relaxed, Release},
55
};
66
use crate::sys::futex::{futex_wait, futex_wake, futex_wake_all};
7-
use crate::sys_common::thread_info::current_thread_unique_ptr;
87
use crate::time::Duration;
98

109
pub type MovableMutex = Mutex;
@@ -248,3 +247,12 @@ impl ReentrantMutex {
248247
}
249248
}
250249
}
250+
251+
/// Get an address that is unique per running thread.
252+
///
253+
/// This can be used as a non-null usize-sized ID.
254+
pub fn current_thread_unique_ptr() -> usize {
255+
// Use a non-drop type to make sure it's still available during thread destruction.
256+
thread_local! { static X: u8 = 0 }
257+
X.with(|x| <*const _>::addr(x))
258+
}

library/std/src/sys_common/thread_info.rs

-9
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ impl ThreadInfo {
3030
}
3131
}
3232

33-
/// Get an address that is unique per running thread.
34-
///
35-
/// This can be used as a non-null usize-sized ID.
36-
pub fn current_thread_unique_ptr() -> usize {
37-
// 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-
4233
pub fn current_thread() -> Option<Thread> {
4334
ThreadInfo::with(|info| info.thread.clone())
4435
}

0 commit comments

Comments
 (0)