1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

nptl: Replace __futex_clocklock_wait64 with __futex_abstimed_wait64

For non null timeouts, the __futex_clocklock_wait64 creates an a
relative timeout by subtracting the current time from the input
argument.  The same behavior can be obtained with FUTEX_WAIT_BITSET
without the need to calculate the relative timeout.  Besides consolidate
the code it also avoid the possible relative timeout issues [1].

The __futex_abstimed_wait64 needs also to return EINVAL syscall
errors.

Checked on x86_64-linux-gnu and i686-linux-gnu.

[1] https://sourceware.org/pipermail/libc-alpha/2020-November/119881.html

Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Adhemerval Zanella
2020-11-21 17:39:44 -03:00
parent a52665818a
commit a3e7aead03
3 changed files with 5 additions and 63 deletions

View File

@@ -391,8 +391,8 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
/* Delay the thread until the timeout is reached. Then return
ETIMEDOUT. */
do
e = __futex_clocklock_wait64 (&(int){0}, 0, clockid, abstime,
private);
e = __futex_abstimed_wait64 (&(unsigned int){0}, 0, clockid,
abstime, private);
while (e != ETIMEDOUT);
return ETIMEDOUT;
}