about summary refs log tree commit diff
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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
index cdde262384..49d68da702 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
@@ -83,11 +83,10 @@ hidden_proto (__lll_timedlock_wait)
 int
 lll_unlock_wake_cb (int *futex)
 {
-  if (__lll_add (futex, -1) - 1 != 0)
-    {
-      *futex = 0;
-      lll_futex_wake (futex, 1);
-    }
+  int val = __lll_test_and_set (futex, 0);
+
+  if (__builtin_expect (val > 1, 0))
+    lll_futex_wake (futex, 1);
 
   return 0;
 }