提交 bf7ececa 编写于 作者: K Keith Owens 提交者: Tony Luck

[IA64] Define an ia64 version of __raw_read_trylock

IA64 is using the generic version of __raw_read_trylock, which always
waits for the lock to be free instead of returning when the lock is in
use.  Define an ia64 version of __raw_read_trylock which behaves
correctly, and drop the generic one.
Signed-off-by: NKeith Owens <kaos@sgi.com>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 f64fa677
......@@ -201,6 +201,16 @@ static inline void __raw_write_unlock(raw_rwlock_t *x)
#endif /* !ASM_SUPPORTED */
#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
static inline int __raw_read_trylock(raw_rwlock_t *x)
{
union {
raw_rwlock_t lock;
__u32 word;
} old, new;
old.lock = new.lock = *x;
old.lock.write_lock = new.lock.write_lock = 0;
++new.lock.read_counter;
return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word;
}
#endif /* _ASM_IA64_SPINLOCK_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册