Changeset ffe4a87 in mainline
- Timestamp:
- 2010-05-25T22:15:03Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e805e2f
- Parents:
- d7da4284
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/spinlock.h
rd7da4284 rffe4a87 115 115 extern void spinlock_lock_debug(spinlock_t *); 116 116 extern void spinlock_unlock_debug(spinlock_t *); 117 extern bool spinlock_locked(spinlock_t *); 118 extern bool spinlock_unlocked(spinlock_t *); 117 119 118 120 /** Unlock spinlock … … 177 179 #define spinlock_trylock(lock) (preemption_disable(), 1) 178 180 #define spinlock_unlock(lock) preemption_enable() 181 #define spinlock_locked(lock) 1 182 #define spinlock_unlocked(lock) 1 179 183 180 184 #define DEADLOCK_PROBE_INIT(pname) … … 283 287 extern void irq_spinlock_pass(irq_spinlock_t *, irq_spinlock_t *); 284 288 extern void irq_spinlock_exchange(irq_spinlock_t *, irq_spinlock_t *); 289 extern bool irq_spinlock_locked(irq_spinlock_t *); 290 extern bool irq_spinlock_unlocked(irq_spinlock_t *); 285 291 286 292 #endif -
kernel/generic/src/synch/spinlock.c
rd7da4284 rffe4a87 128 128 void spinlock_unlock_debug(spinlock_t *lock) 129 129 { 130 ASSERT_SPINLOCK( atomic_get(&lock->val) != 0, lock);130 ASSERT_SPINLOCK(spinlock_locked(lock), lock); 131 131 132 132 /* … … 165 165 166 166 return rc; 167 } 168 169 /** Find out whether the spinlock is currently locked. 170 * 171 * @param lock Spinlock. 172 * @return True if the spinlock is locked, false otherwise. 173 */ 174 bool spinlock_locked(spinlock_t *lock) 175 { 176 return atomic_get(&lock->val) != 0; 177 } 178 179 /** Find out whether the spinlock is currently unlocked. 180 * 181 * @param lock Spinlock. 182 * @return True if the spinlock is not locked, false otherwise. 183 */ 184 bool spinlock_unlocked(spinlock_t *lock) 185 { 186 return atomic_get(&lock->val) == 0; 167 187 } 168 188 … … 314 334 } 315 335 336 /** Find out whether the IRQ spinlock is currently locked. 337 * 338 * @param lock IRQ spinlock. 339 * @return True if the IRQ spinlock is locked, false otherwise. 340 */ 341 bool irq_spinlock_locked(irq_spinlock_t *ilock) 342 { 343 return spinlock_locked(&ilock->lock); 344 } 345 346 /** Find out whether the IRQ spinlock is currently unlocked. 347 * 348 * @param lock IRQ spinlock. 349 * @return True if the IRQ spinlock is not locked, false otherwise. 350 */ 351 bool irq_spinlock_unlocked(irq_spinlock_t *ilock) 352 { 353 return spinlock_unlocked(&ilock->lock); 354 } 355 316 356 /** @} 317 357 */
Note:
See TracChangeset
for help on using the changeset viewer.