about summary refs log tree commit diff
path: root/library/std/src/sys/pal
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-04-01 13:35:16 +0200
committerjoboet <jonasboettiger@icloud.com>2025-04-01 13:35:16 +0200
commitff37c7d3954ce9d1c9265e7c82a0bb7b6eba6fee (patch)
treebd51ab4a98be13cd8519e284c1d1bbb496d67ff2 /library/std/src/sys/pal
parent45b40a75966b36d3588f173441896fddad01cd80 (diff)
std: use the address of `errno` to identify threads in `unique_thread_exit`
Getting the address of `errno` should be just as cheap as `pthread_self()` and avoids having to use the expensive `Mutex` logic because it always results in a pointer.
Diffstat (limited to 'library/std/src/sys/pal')
-rw-r--r--library/std/src/sys/pal/unix/os.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index f47421c6705..3b712f316cd 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -61,7 +61,7 @@ unsafe extern "C" {
     #[cfg_attr(target_os = "aix", link_name = "_Errno")]
     // SAFETY: this will always return the same pointer on a given thread.
     #[unsafe(ffi_const)]
-    fn errno_location() -> *mut c_int;
+    pub safe fn errno_location() -> *mut c_int;
 }
 
 /// Returns the platform-specific value of errno