mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-26 12:41:05 +00:00
Use C11 atomics instead of atomic_and/or
Remove the 4 uses of atomic_and and atomic_or with atomic_fetch_and_acquire and atomic_fetch_or_acquire. This is preserves existing implied semantics, however relaxed MO on FUTEX_OWNER_DIED accesses may be correct. Passes regress on AArch64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
774d43f27d
commit
8114b95cef
@ -539,7 +539,7 @@ start_thread (void *arg)
|
|||||||
# endif
|
# endif
|
||||||
this->__list.__next = NULL;
|
this->__list.__next = NULL;
|
||||||
|
|
||||||
atomic_or (&this->__lock, FUTEX_OWNER_DIED);
|
atomic_fetch_or_acquire (&this->__lock, FUTEX_OWNER_DIED);
|
||||||
futex_wake ((unsigned int *) &this->__lock, 1,
|
futex_wake ((unsigned int *) &this->__lock, 1,
|
||||||
/* XYZ */ FUTEX_SHARED);
|
/* XYZ */ FUTEX_SHARED);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
|||||||
|
|
||||||
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
||||||
{
|
{
|
||||||
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
atomic_fetch_and_acquire (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
||||||
|
|
||||||
/* We got the mutex. */
|
/* We got the mutex. */
|
||||||
mutex->__data.__count = 1;
|
mutex->__data.__count = 1;
|
||||||
|
@ -392,7 +392,7 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
|
|||||||
|
|
||||||
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
||||||
{
|
{
|
||||||
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
atomic_fetch_and_acquire (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
||||||
|
|
||||||
/* We got the mutex. */
|
/* We got the mutex. */
|
||||||
mutex->__data.__count = 1;
|
mutex->__data.__count = 1;
|
||||||
|
@ -308,7 +308,7 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
|
|||||||
|
|
||||||
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
|
||||||
{
|
{
|
||||||
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
atomic_fetch_and_acquire (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
|
||||||
|
|
||||||
/* We got the mutex. */
|
/* We got the mutex. */
|
||||||
mutex->__data.__count = 1;
|
mutex->__data.__count = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user