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

Michael S. Tsirkin mst at mellanox.co.il
Sun Feb 19 04:45:53 PST 2006


Quoting r. Or Gerlitz <ogerlitz at voltaire.com>:
> Subject: [PATCH] mutex-backport: add mutex_trylock support
> 
> 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 */

"negated to the down_trylock() return values" probably means !down_trylock
which is already obvious.
So what does the comment mean?

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies



More information about the general mailing list