aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/lowlevellock.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevellock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
index db10573a45..eb3e689b9e 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
@@ -27,13 +27,15 @@
void
__lll_lock_wait (int *futex, int val)
{
+ /* In the loop we are going to add 2 instead of 1 which is what
+ the caller did. Account for that. */
+ --val;
do
{
- lll_futex_wait (futex, val + 1);
- val = atomic_exchange_and_add (futex, 1);
+ lll_futex_wait (futex, val + 2);
+ val = atomic_exchange_and_add (futex, 2);
}
while (val != 0);
- *futex = 2;
}
hidden_proto (__lll_lock_wait)