[openib-general] [PATCH] mutex-backport: add mutex_trylock support

Or Gerlitz ogerlitz at voltaire.com
Sun Feb 19 04:39:24 PST 2006


I've allowed myself to it commit in r5443

added mutex_trylock() to backport hacks

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>

Index: mutex-backport.h
===================================================================
--- mutex-backport.h    (revision 5225)
+++ mutex-backport.h    (revision 5443)
@@ -10,6 +10,9 @@
 #define mutex_init(foo) init_MUTEX(foo)
 #define mutex_lock(foo) down(foo)
 #define mutex_lock_interruptible(foo) down_interruptible(foo)
+/* this function follows the spin_trylock() convention, so        *
+ * it is negated to the down_trylock() return values! Be careful  */
+#define mutex_trylock(foo) !down_trylock(foo)
 #define mutex_unlock(foo) up(foo)

 #endif /* __LINUX_MUTEX_H */





More information about the general mailing list