mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-18 14:40:06 +00:00
Check value of futex before updating in __lll_timedlock
2014-08-12 Bernard Ogden <bernie.ogden@linaro.org> [BZ #16892] * sysdeps/nptl/lowlevellock.h (__lll_timedlock): Use atomic_compare_and_exchange_bool_acq rather than atomic_exchange_acq.
This commit is contained in:
parent
bb2ce41656
commit
4e75751cbb
@ -1,3 +1,9 @@
|
|||||||
|
2014-08-12 Bernard Ogden <bernie.ogden@linaro.org>
|
||||||
|
|
||||||
|
[BZ #16892]
|
||||||
|
* sysdeps/nptl/lowlevellock.h (__lll_timedlock): Use
|
||||||
|
atomic_compare_and_exchange_bool_acq rather than atomic_exchange_acq.
|
||||||
|
|
||||||
2014-08-12 Sean Anderson <seanga2@gmail.com>
|
2014-08-12 Sean Anderson <seanga2@gmail.com>
|
||||||
|
|
||||||
* malloc/malloc.c: Fix typo in comment.
|
* malloc/malloc.c: Fix typo in comment.
|
||||||
|
@ -88,12 +88,15 @@ extern int __lll_timedlock_wait (int *futex, const struct timespec *,
|
|||||||
extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
|
extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
|
||||||
int private) attribute_hidden;
|
int private) attribute_hidden;
|
||||||
|
|
||||||
|
/* Take futex if it is untaken.
|
||||||
|
Otherwise block until either we get the futex or abstime runs out. */
|
||||||
#define __lll_timedlock(futex, abstime, private) \
|
#define __lll_timedlock(futex, abstime, private) \
|
||||||
({ \
|
({ \
|
||||||
int *__futex = (futex); \
|
int *__futex = (futex); \
|
||||||
int __val = 0; \
|
int __val = 0; \
|
||||||
\
|
\
|
||||||
if (__glibc_unlikely (atomic_exchange_acq (__futex, 1))) \
|
if (__glibc_unlikely \
|
||||||
|
(atomic_compare_and_exchange_bool_acq (__futex, 1, 0))) \
|
||||||
__val = __lll_timedlock_wait (__futex, abstime, private); \
|
__val = __lll_timedlock_wait (__futex, abstime, private); \
|
||||||
__val; \
|
__val; \
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user