Lines Matching refs:rw
67 static inline int arch_read_trylock(arch_rwlock_t *rw) in arch_read_trylock() argument
73 arch_spin_lock(&(rw->lock_mutex)); in arch_read_trylock()
79 if (rw->counter > 0) { in arch_read_trylock()
80 rw->counter--; in arch_read_trylock()
84 arch_spin_unlock(&(rw->lock_mutex)); in arch_read_trylock()
91 static inline int arch_write_trylock(arch_rwlock_t *rw) in arch_write_trylock() argument
97 arch_spin_lock(&(rw->lock_mutex)); in arch_write_trylock()
105 if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) { in arch_write_trylock()
106 rw->counter = 0; in arch_write_trylock()
109 arch_spin_unlock(&(rw->lock_mutex)); in arch_write_trylock()
115 static inline void arch_read_lock(arch_rwlock_t *rw) in arch_read_lock() argument
117 while (!arch_read_trylock(rw)) in arch_read_lock()
121 static inline void arch_write_lock(arch_rwlock_t *rw) in arch_write_lock() argument
123 while (!arch_write_trylock(rw)) in arch_write_lock()
127 static inline void arch_read_unlock(arch_rwlock_t *rw) in arch_read_unlock() argument
132 arch_spin_lock(&(rw->lock_mutex)); in arch_read_unlock()
133 rw->counter++; in arch_read_unlock()
134 arch_spin_unlock(&(rw->lock_mutex)); in arch_read_unlock()
138 static inline void arch_write_unlock(arch_rwlock_t *rw) in arch_write_unlock() argument
143 arch_spin_lock(&(rw->lock_mutex)); in arch_write_unlock()
144 rw->counter = __ARCH_RW_LOCK_UNLOCKED__; in arch_write_unlock()
145 arch_spin_unlock(&(rw->lock_mutex)); in arch_write_unlock()