Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176335
b: refs/heads/master
c: 29671f2
h: refs/heads/master
i:
  176333: d8173de
  176331: ff66d0d
  176327: 00bbe59
  176319: 350c463
v: v3
  • Loading branch information
Amerigo Wang authored and Linus Torvalds committed Dec 15, 2009
1 parent de4b9e5 commit fbf8e63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 118d52da1816471ac875bb9f1ee51737e82b1d71
refs/heads/master: 29671f22a8b6522db3b126a3fdfb208759ce46e3
6 changes: 1 addition & 5 deletions trunk/include/linux/rwsem-spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ extern int __down_write_trylock(struct rw_semaphore *sem);
extern void __up_read(struct rw_semaphore *sem);
extern void __up_write(struct rw_semaphore *sem);
extern void __downgrade_write(struct rw_semaphore *sem);

static inline int rwsem_is_locked(struct rw_semaphore *sem)
{
return (sem->activity != 0);
}
extern int rwsem_is_locked(struct rw_semaphore *sem);

#endif /* __KERNEL__ */
#endif /* _LINUX_RWSEM_SPINLOCK_H */
13 changes: 13 additions & 0 deletions trunk/lib/rwsem-spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ struct rwsem_waiter {
#define RWSEM_WAITING_FOR_WRITE 0x00000002
};

int rwsem_is_locked(struct rw_semaphore *sem)
{
int ret = 1;
unsigned long flags;

if (spin_trylock_irqsave(&sem->wait_lock, flags)) {
ret = (sem->activity != 0);
spin_unlock_irqrestore(&sem->wait_lock, flags);
}
return ret;
}
EXPORT_SYMBOL(rwsem_is_locked);

/*
* initialise the semaphore
*/
Expand Down

0 comments on commit fbf8e63

Please sign in to comment.