about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2022-09-09 14:22:26 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2022-09-09 14:22:26 +0100
commita364a3a7090b82ddd30e9209df2af56e781d51e4 (patch)
tree90412a565deeeb7aef54205159c0422af71771c9 /nptl
parent53b251c9ff03ab59ba58fcddb9dc97c69f25fadc (diff)
downloadglibc-a364a3a7090b82ddd30e9209df2af56e781d51e4.tar.gz
glibc-a364a3a7090b82ddd30e9209df2af56e781d51e4.tar.xz
glibc-a364a3a7090b82ddd30e9209df2af56e781d51e4.zip
Use C11 atomics instead of atomic_decrement(_val)
Replace atomic_decrement and atomic_decrement_val with
atomic_fetch_add_relaxed.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/nptl_setxid.c2
-rw-r--r--nptl/pthread_create.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/nptl/nptl_setxid.c b/nptl/nptl_setxid.c
index aa863c7ea8..e709822b9b 100644
--- a/nptl/nptl_setxid.c
+++ b/nptl/nptl_setxid.c
@@ -88,7 +88,7 @@ __nptl_setxid_sighandler (int sig, siginfo_t *si, void *ctx)
   self->setxid_futex = 1;
   futex_wake (&self->setxid_futex, 1, FUTEX_PRIVATE);
 
-  if (atomic_decrement_val (&xidcmd->cntr) == 0)
+  if (atomic_fetch_add_relaxed (&xidcmd->cntr, -1) == 1)
     futex_wake ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
 }
 libc_hidden_def (__nptl_setxid_sighandler)
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 308db65cd4..e7e4ede6b2 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -861,7 +861,7 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
 	 NOTES above).  */
 
       /* Oops, we lied for a second.  */
-      atomic_decrement (&__nptl_nthreads);
+      atomic_fetch_add_relaxed (&__nptl_nthreads, -1);
 
       /* Free the resources.  */
       __nptl_deallocate_stack (pd);