1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

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>
This commit is contained in:
Wilco Dijkstra
2022-09-22 15:32:40 +01:00
parent 8114b95cef
commit d1babeb32d
9 changed files with 12 additions and 12 deletions

View File

@ -72,8 +72,8 @@ static uint32_t nl_timestamp;
uint32_t
__bump_nl_timestamp (void)
{
if (atomic_increment_val (&nl_timestamp) == 0)
atomic_increment (&nl_timestamp);
if (atomic_fetch_add_relaxed (&nl_timestamp, 1) + 1 == 0)
atomic_fetch_add_relaxed (&nl_timestamp, 1);
return nl_timestamp;
}
@ -309,7 +309,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
if (cache_valid_p ())
{
data = cache;
atomic_increment (&cache->usecnt);
atomic_fetch_add_relaxed (&cache->usecnt, 1);
}
else
{