about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/single-thread.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-06-07 13:09:40 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-07-05 10:14:47 -0300
commite070501d12b47e88c1ff8c313f887976fb578938 (patch)
tree8ee321cfb78050dde3c6e84e9a9da9b6eeaf0963 /sysdeps/unix/sysv/linux/single-thread.h
parentaf1aa36c617d72e80ff6b268bf927b6642d90823 (diff)
downloadglibc-e070501d12b47e88c1ff8c313f887976fb578938.tar.gz
glibc-e070501d12b47e88c1ff8c313f887976fb578938.tar.xz
glibc-e070501d12b47e88c1ff8c313f887976fb578938.zip
Replace __libc_multiple_threads with __libc_single_threaded
And also fixes the SINGLE_THREAD_P macro for SINGLE_THREAD_BY_GLOBAL,
since header inclusion single-thread.h is in the wrong order, the define
needs to come before including sysdeps/unix/sysdep.h.  The macro
is now moved to a per-arch single-threade.h header.

The SINGLE_THREAD_P is used on some more places.

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Diffstat (limited to 'sysdeps/unix/sysv/linux/single-thread.h')
-rw-r--r--sysdeps/unix/sysv/linux/single-thread.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/single-thread.h b/sysdeps/unix/sysv/linux/single-thread.h
index 4529a906d2..30dde4e81a 100644
--- a/sysdeps/unix/sysv/linux/single-thread.h
+++ b/sysdeps/unix/sysv/linux/single-thread.h
@@ -19,6 +19,10 @@
 #ifndef _SINGLE_THREAD_H
 #define _SINGLE_THREAD_H
 
+#ifndef __ASSEMBLER__
+# include <sys/single_threaded.h>
+#endif
+
 /* The default way to check if the process is single thread is by using the
    pthread_t 'multiple_threads' field.  However, for some architectures it is
    faster to either use an extra field on TCB or global variables (the TCB
@@ -27,16 +31,11 @@
    The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
    check to use global variables instead of the pthread_t field.  */
 
-#ifndef __ASSEMBLER__
-extern int __libc_multiple_threads;
-libc_hidden_proto (__libc_multiple_threads)
-#endif
-
 #if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld)
 # define SINGLE_THREAD_P \
   (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
 #else
-# define SINGLE_THREAD_P (__libc_multiple_threads == 0)
+# define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
 #endif
 
 #define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P