aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-21 17:39:44 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-25 10:43:18 -0300
commita3e7aead03d558e77fc8b9dc4d567b7bb8619545 (patch)
tree14222d7756f1ad6547d429f8f59a353475b85a6f /nptl
parenta52665818adb76df1563ae7aa45e74e92d9acd59 (diff)
downloadglibc-a3e7aead03d558e77fc8b9dc4d567b7bb8619545.tar
glibc-a3e7aead03d558e77fc8b9dc4d567b7bb8619545.tar.gz
glibc-a3e7aead03d558e77fc8b9dc4d567b7bb8619545.tar.bz2
glibc-a3e7aead03d558e77fc8b9dc4d567b7bb8619545.zip
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>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/pthread_mutex_timedlock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 0ec47359be..e643eab258 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -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;
}