summaryrefslogtreecommitdiff
path: root/nptl/pthread_mutex_trylock.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_mutex_trylock.c')
-rw-r--r--nptl/pthread_mutex_trylock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 4990ecd711..9db904c60b 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -84,9 +84,11 @@ __pthread_mutex_trylock (mutex)
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
- int newval
+ int newval = id | (oldval & FUTEX_WAITERS);
+
+ newval
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
- id, oldval);
+ newval, oldval);
if (newval != oldval)
{