Changeset 543662b in mainline
- Timestamp:
- 2018-11-20T18:57:09Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0705fc5
- Parents:
- a615be0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/spinlock.h
ra615be0 r543662b 99 99 assert(expr) 100 100 101 #define spinlock_lock(lock) atomic_lock_arch(&(lock)->val) 102 #define spinlock_unlock(lock) spinlock_unlock_nondebug((lock)) 101 /** Acquire spinlock 102 * 103 * @param lock Pointer to spinlock_t structure. 104 */ 105 NO_TRACE static inline void spinlock_lock(spinlock_t *lock) 106 { 107 preemption_disable(); 108 while (atomic_flag_test_and_set_explicit(&lock->flag, 109 memory_order_acquire)) 110 ; 111 } 112 113 /** Release spinlock 114 * 115 * @param lock Pointer to spinlock_t structure. 116 */ 117 NO_TRACE static inline void spinlock_unlock(spinlock_t *lock) 118 { 119 atomic_flag_clear_explicit(&lock->flag, memory_order_release); 120 preemption_enable(); 121 } 103 122 104 123 #endif /* CONFIG_DEBUG_SPINLOCK */ … … 115 134 extern void spinlock_unlock_debug(spinlock_t *); 116 135 extern bool spinlock_locked(spinlock_t *); 117 118 /** Unlock spinlock119 *120 * Unlock spinlock for non-debug kernels.121 *122 * @param sl Pointer to spinlock_t structure.123 *124 */125 NO_TRACE static inline void spinlock_unlock_nondebug(spinlock_t *lock)126 {127 atomic_flag_clear_explicit(&lock->flag, memory_order_release);128 preemption_enable();129 }130 136 131 137 #ifdef CONFIG_DEBUG_SPINLOCK
Note:
See TracChangeset
for help on using the changeset viewer.