From d1babeb32de5dae8893c640bd925357b218d846c Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Thu, 22 Sep 2022 15:32:40 +0100 Subject: 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 --- htl/pt-create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'htl') 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 -- cgit 1.4.1