aboutsummaryrefslogtreecommitdiff
path: root/nptl
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 /nptl
parentaf1aa36c617d72e80ff6b268bf927b6642d90823 (diff)
downloadglibc-e070501d12b47e88c1ff8c313f887976fb578938.zip
glibc-e070501d12b47e88c1ff8c313f887976fb578938.tar.gz
glibc-e070501d12b47e88c1ff8c313f887976fb578938.tar.bz2
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 'nptl')
-rw-r--r--nptl/Makefile1
-rw-r--r--nptl/allocatestack.c6
-rw-r--r--nptl/libc_multiple_threads.c28
-rw-r--r--nptl/pthread_cancel.c2
4 files changed, 1 insertions, 36 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index b585663..3d2ce8a 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -50,7 +50,6 @@ routines = \
events \
futex-internal \
libc-cleanup \
- libc_multiple_threads \
lowlevellock \
nptl-stack \
nptl_deallocate_tsd \
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 01a282f..98f5f6d 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -292,9 +292,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* This is at least the second thread. */
pd->header.multiple_threads = 1;
-#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
-#endif
#ifdef NEED_DL_SYSINFO
SETUP_THREAD_SYSINFO (pd);
@@ -413,9 +410,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* This is at least the second thread. */
pd->header.multiple_threads = 1;
-#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
-#endif
#ifdef NEED_DL_SYSINFO
SETUP_THREAD_SYSINFO (pd);
diff --git a/nptl/libc_multiple_threads.c b/nptl/libc_multiple_threads.c
deleted file mode 100644
index 0c2dc33..0000000
--- a/nptl/libc_multiple_threads.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2002-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <pthreadP.h>
-
-#if IS_IN (libc)
-# ifndef TLS_MULTIPLE_THREADS_IN_TCB
-/* Variable set to a nonzero value either if more than one thread runs or ran,
- or if a single-threaded process is trying to cancel itself. See
- nptl/descr.h for more context on the single-threaded process case. */
-int __libc_multiple_threads;
-libc_hidden_data_def (__libc_multiple_threads)
-# endif
-#endif
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index e67b2df..459317d 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -161,7 +161,7 @@ __pthread_cancel (pthread_t th)
points get executed. */
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
+ __libc_single_threaded_internal = 0;
#endif
}
while (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling, &oldval,