diff options
Diffstat (limited to 'nptl/lowlevelrobustlock.c')
-rw-r--r-- | nptl/lowlevelrobustlock.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nptl/lowlevelrobustlock.c b/nptl/lowlevelrobustlock.c index 3525807..291d32a 100644 --- a/nptl/lowlevelrobustlock.c +++ b/nptl/lowlevelrobustlock.c @@ -36,14 +36,17 @@ __lll_robust_lock_wait (int *futex, int private) do { + /* If the owner died, return the present value of the futex. */ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED)) return oldval; + /* Try to put the lock into state 'acquired, possibly with waiters'. */ int newval = oldval | FUTEX_WAITERS; if (oldval != newval && atomic_compare_and_exchange_bool_acq (futex, newval, oldval)) continue; + /* If *futex == 2, wait until woken. */ lll_futex_wait (futex, newval, private); try: @@ -67,7 +70,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime, int tid = THREAD_GETMEM (THREAD_SELF, tid); int oldval = *futex; - /* If the futex changed meanwhile try locking again. */ + /* If the futex changed meanwhile, try locking again. */ if (oldval == 0) goto try; @@ -100,15 +103,17 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime, return ETIMEDOUT; #endif - /* Wait. */ + /* If the owner died, return the present value of the futex. */ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED)) return oldval; + /* Try to put the lock into state 'acquired, possibly with waiters'. */ int newval = oldval | FUTEX_WAITERS; if (oldval != newval && atomic_compare_and_exchange_bool_acq (futex, newval, oldval)) continue; + /* If *futex == 2, wait until woken or timeout. */ #if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \ || !defined lll_futex_timed_wait_bitset) lll_futex_timed_wait (futex, newval, &rt, private); |