Re: [PATCH RFC] 'spinlock/rwlock fixes' V3 [1/1]
From: Linus Torvalds
Date: Thu Jan 20 2005 - 11:26:09 EST
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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/