about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 5751206dd9..8b460eb98f 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -127,6 +127,20 @@ __lll_mutex_trylock (int *futex)
 #define lll_mutex_trylock(futex) __lll_mutex_trylock (&(futex))
 
 
+static inline int
+__attribute__ ((always_inline))
+__lll_mutex_cond_trylock (int *futex)
+{
+    unsigned int old;
+
+    __asm __volatile ("cs %0,%3,%1"
+		       : "=d" (old), "=Q" (*futex)
+		       : "0" (0), "d" (2), "m" (*futex) : "cc" );
+    return old != 0;
+}
+#define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))
+
+
 extern void __lll_lock_wait (int *futex) attribute_hidden;
 
 static inline void