This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [BZ 5240][PATCH] Pthread hang where there are still waiters when mutex is in "unlocked" state.
On Sun, 2007-11-25 at 16:39 +0100, Martin Schwidefsky wrote:
> So there is a solution to this without a futex_wake call on the
> timeout path. The analog C code using atomic_exchange_acq has to be
> added.
The patch below should do the trick. At least it fixes the problem on
s390. Please consider.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
---
2007-11-25 Martin Schwidefsky <schwidefsky@de.ibm.com>
[BZ #5240]
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_timedlock_wait):
Always set the lock value to 2 before leaving the function,
otherwise a wakeup signal can get lost.
diff -urpN libc/nptl/sysdeps/unix/sysv/linux/lowlevellock.c libc-lll/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
--- libc/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-11-09 13:20:22.000000000 +0100
+++ libc-lll/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-11-25 22:56:51.000000000 +0100
@@ -85,7 +85,7 @@ __lll_timedlock_wait (int *futex, const
lll_futex_timed_wait (futex, 2, &rt, private);
}
- if (atomic_compare_and_exchange_bool_acq (futex, 2, 0) == 0)
+ if (atomic_exchange_acq (futex, 2) == 0)
return 0;
}
while (rt.tv_sec >= 0);