about summary refs log tree commit diff
path: root/sysdeps/nptl/libc_start_call_main.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
commit43fe356d18e12b5826dfee4c0b57b5c75c3a9a72 (patch)
tree70aff7217ebdc746c77f3f5b2a18a3e7ae051579 /sysdeps/nptl/libc_start_call_main.h
parent130fca173f323a24b41873b6656ab77c7cff86e1 (diff)
downloadglibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.tar.gz
glibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.tar.xz
glibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.zip
nptl: Move internal __nptl_nthreads variable into libc
Reviewed-by: Adhemerval Zanella   <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl/libc_start_call_main.h')
-rw-r--r--sysdeps/nptl/libc_start_call_main.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/sysdeps/nptl/libc_start_call_main.h b/sysdeps/nptl/libc_start_call_main.h
index 5218e7ab1e..112cc20a7a 100644
--- a/sysdeps/nptl/libc_start_call_main.h
+++ b/sysdeps/nptl/libc_start_call_main.h
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <atomic.h>
+#include <nptl/pthreadP.h>
 
 _Noreturn static void
 __libc_start_call_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
@@ -69,17 +70,7 @@ __libc_start_call_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
       /* One less thread.  Decrement the counter.  If it is zero we
          terminate the entire process.  */
       result = 0;
-# ifdef SHARED
-      unsigned int *ptr = __libc_pthread_functions.ptr_nthreads;
-#  ifdef PTR_DEMANGLE
-      PTR_DEMANGLE (ptr);
-#  endif
-# else
-      extern unsigned int __nptl_nthreads __attribute ((weak));
-      unsigned int *const ptr = &__nptl_nthreads;
-# endif
-
-      if (! atomic_decrement_and_test (ptr))
+      if (! atomic_decrement_and_test (&__nptl_nthreads))
         /* Not much left to do but to exit the thread, not the process.  */
         __exit_thread ();
     }