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

Michael S. Tsirkin mst at mellanox.co.il
Sun Feb 19 05:06:37 PST 2006


Quoting r. Or Gerlitz <ogerlitz at voltaire.com>:
> >>+/* 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)
> 
> >"negated to the down_trylock() return values" probably means !down_trylock
> >which is already obvious. So what does the comment mean?
> 
> the comment comes to warn people that a code that was using 
> if(!down_trylock(foo)) need to be changed to if(mutex_trylock(foo)) and 
> viseversa (code that was using if(down_trylock(foo)) etc) - that's all.

Lets be explicit then, and give some actual information:

/* NB: mutex_trylock returns 1 on success, down_trylock - 0 on success. */

Make sense?

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies



More information about the general mailing list