glibc/glibc-2.7-lowlevellock.patch

27 lines
800 B
Diff
Raw Permalink Normal View History

2007-11-01 Ryan S. Arnold <rsa@us.ibm.com>
* nptl/sysdeps/unix/sysv/linux/lowlevellock.c
(__lll_timedlock_wait) Wake before returning timeout.
--- glibc-2.7/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-08-14 14:59:34.000000000 -0500
+++ glibc-2.7.new/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-11-01 12:25:49.000000000 -0500
@@ -76,12 +76,16 @@
--rt.tv_sec;
}
+ int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
/* Already timed out? */
if (rt.tv_sec < 0)
- return ETIMEDOUT;
+ {
+ if (oldval == 0)
+ lll_futex_wake (futex, 1, private);
+ return ETIMEDOUT;
+ }
/* Wait. */
- int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
if (oldval != 0)
lll_futex_timed_wait (futex, 2, &rt, private);
}