mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-04 10:50:07 +00:00
Move assignment out of the CAS condition
Update commit49302b8fdf
Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Nov 11 06:54:01 2021 -0800 Avoid extra load with CAS in __pthread_mutex_clocklock_common [BZ #28537] Replace boolean CAS with value CAS to avoid the extra load. and commit0b82747dc4
Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Nov 11 06:31:51 2021 -0800 Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537] Replace boolean CAS with value CAS to avoid the extra load. by moving assignment out of the CAS condition. (cherry picked from commit120ac6d238
)
This commit is contained in:
parent
a6b81f605d
commit
6bcfbee727
@ -305,10 +305,9 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
|
|||||||
meantime. */
|
meantime. */
|
||||||
if ((oldval & FUTEX_WAITERS) == 0)
|
if ((oldval & FUTEX_WAITERS) == 0)
|
||||||
{
|
{
|
||||||
int val;
|
int val = atomic_compare_and_exchange_val_acq
|
||||||
if ((val = atomic_compare_and_exchange_val_acq
|
(&mutex->__data.__lock, oldval | FUTEX_WAITERS, oldval);
|
||||||
(&mutex->__data.__lock, oldval | FUTEX_WAITERS,
|
if (val != oldval)
|
||||||
oldval)) != oldval)
|
|
||||||
{
|
{
|
||||||
oldval = val;
|
oldval = val;
|
||||||
continue;
|
continue;
|
||||||
|
@ -234,10 +234,9 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
|
|||||||
meantime. */
|
meantime. */
|
||||||
if ((oldval & FUTEX_WAITERS) == 0)
|
if ((oldval & FUTEX_WAITERS) == 0)
|
||||||
{
|
{
|
||||||
int val;
|
int val = atomic_compare_and_exchange_val_acq
|
||||||
if ((val = atomic_compare_and_exchange_val_acq
|
(&mutex->__data.__lock, oldval | FUTEX_WAITERS, oldval);
|
||||||
(&mutex->__data.__lock, oldval | FUTEX_WAITERS,
|
if (val != oldval)
|
||||||
oldval)) != oldval)
|
|
||||||
{
|
{
|
||||||
oldval = val;
|
oldval = val;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user