about summary refs log tree commit diff
path: root/htl
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2022-09-22 15:32:40 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2022-09-23 15:59:56 +0100
commitd1babeb32de5dae8893c640bd925357b218d846c (patch)
treec5ee8e42e03e6a4caf2eb645d5f9b7a8bdbdb6e1 /htl
parent8114b95cef10a5a1fc3e529ab8b3a75f56fe889a (diff)
downloadglibc-d1babeb32de5dae8893c640bd925357b218d846c.tar.gz
glibc-d1babeb32de5dae8893c640bd925357b218d846c.tar.xz
glibc-d1babeb32de5dae8893c640bd925357b218d846c.zip
Use C11 atomics instead of atomic_increment(_val)
Replace atomic_increment and atomic_increment_val with atomic_fetch_add_relaxed.
One case in sem_post.c uses release semantics (see comment above it).
The others are simple counters and do not protect any shared data from
concurrent accesses.

Passes regress on AArch64.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'htl')
-rw-r--r--htl/pt-create.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/htl/pt-create.c b/htl/pt-create.c
index 36f138b498..5d37edbbff 100644
--- a/htl/pt-create.c
+++ b/htl/pt-create.c
@@ -228,7 +228,7 @@ __pthread_create_internal (struct __pthread **thread,
      the number of threads from within the new thread isn't an option
      since this thread might return and call `pthread_exit' before the
      new thread runs.  */
-  atomic_increment (&__pthread_total);
+  atomic_fetch_add_relaxed (&__pthread_total, 1);
 
   /* Store a pointer to this thread in the thread ID lookup table.  We
      could use __thread_setid, however, we only lock for reading as no