NaCl: Fix thinko in last change.

This commit is contained in:
Roland McGrath 2015-05-26 16:11:46 -07:00
parent 1f3a37b19c
commit 4da82229f0
1 changed files with 9 additions and 8 deletions

View File

@ -36,17 +36,18 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime, int private)
return EINVAL; return EINVAL;
/* Try locking. */ /* Try locking. */
int result = 0;
while (atomic_exchange_acq (futex, 2) != 0) while (atomic_exchange_acq (futex, 2) != 0)
{ {
/* If *futex == 2, wait until woken or timeout. */ /* If *futex == 2, wait until woken or timeout. */
result = __nacl_irt_futex.futex_wait_abs ((volatile int *) futex, 2, int err = __nacl_irt_futex.futex_wait_abs ((volatile int *) futex, 2,
abstime); abstime);
if (__glibc_likely (result == 0) if (err != 0)
|| __glibc_likely (result == ETIMEDOUT)) {
break; if (__glibc_likely (err == ETIMEDOUT))
assert (result == EAGAIN); return err;
assert (err == EAGAIN);
}
} }
return result; return 0;
} }