Re: [PATCH RFC] 'spinlock/rwlock fixes' V3 [1/1]

From: Linus Torvalds <torvalds_at_osdl.org>
Date: 2005-01-21 03:18:42
On Wed, 19 Jan 2005, Chris Wedgwood wrote:
> 
>   * i386, ia64: rename rwlock_is_locked to rwlock_write_locked as this
>     is IMO a better name

I actually much prefer the "read_can_lock()" suggestion by Peter.

Also, why this:

	+#define rwlock_read_locked(x) (atomic_read((atomic_t *)&(x)->lock) <= 0)

what the _heck_ is that "atomic_read((atomic_t *)&(x)->lock)", and why is 
it not just a "(int)(x)->lock" instead?

So I think it would be much better as

	#define read_can_lock(x) ((int)(x)->lock > 0)

which seems simple and straightforward.

And it probably should be in <asm-i386/rwlock.h>, since that is where the 
actual implementation is, and <asm-i386/spinlock.h> doesn't really have 
any clue what the rules are, and shouldn't act like it has.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Jan 20 12:41:34 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:34 EST