about summary refs log tree commit diff
path: root/sysdeps/nptl
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2022-09-22 15:40:37 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2022-09-23 15:59:56 +0100
commit4a07fbb689eeec30e7d71a0d144c26e0d1e424ac (patch)
tree85d53e165fb64b144ce9ac3018cd90afdd70bf4f /sysdeps/nptl
parentd1babeb32de5dae8893c640bd925357b218d846c (diff)
downloadglibc-4a07fbb689eeec30e7d71a0d144c26e0d1e424ac.tar.gz
glibc-4a07fbb689eeec30e7d71a0d144c26e0d1e424ac.tar.xz
glibc-4a07fbb689eeec30e7d71a0d144c26e0d1e424ac.zip
Use C11 atomics instead of atomic_decrement_and_test
Replace atomic_decrement_and_test with atomic_fetch_add_relaxed.
These are simple counters which do not protect any shared data from
concurrent accesses. Also remove the unused file cond-perf.c.

Passes regress on AArch64.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r--sysdeps/nptl/libc_start_call_main.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/nptl/libc_start_call_main.h b/sysdeps/nptl/libc_start_call_main.h
index a9e85f2b09..c10a16b2c4 100644
--- a/sysdeps/nptl/libc_start_call_main.h
+++ b/sysdeps/nptl/libc_start_call_main.h
@@ -65,7 +65,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;
-      if (! atomic_decrement_and_test (&__nptl_nthreads))
+      if (atomic_fetch_add_relaxed (&__nptl_nthreads, -1) != 1)
         /* Not much left to do but to exit the thread, not the process.  */
 	while (1)
 	  INTERNAL_SYSCALL_CALL (exit, 0);