lkml.org 
[lkml]   [2005]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] 'spinlock/rwlock fixes' V3 [1/1]


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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.079 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site