Changeset 53f9821 in mainline for generic/src/synch/spinlock.c
- Timestamp:
- 2006-03-20T20:32:17Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 018d957e
- Parents:
- 9d3e185
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/synch/spinlock.c
r9d3e185 r53f9821 52 52 } 53 53 54 #ifdef CONFIG_DEBUG_SPINLOCK55 54 /** Lock spinlock 56 55 * … … 61 60 * @param sl Pointer to spinlock_t structure. 62 61 */ 63 void spinlock_lock(spinlock_t *sl) 62 #ifdef CONFIG_DEBUG_SPINLOCK 63 void spinlock_lock_debug(spinlock_t *sl) 64 64 { 65 65 count_t i = 0; … … 83 83 if (deadlock_reported) 84 84 printf("cpu%d: not deadlocked\n", CPU->id); 85 86 /*87 * Prevent critical section code from bleeding out this way up.88 */89 CS_ENTER_BARRIER();90 91 }92 93 #else94 95 /** Lock spinlock96 *97 * Lock spinlock.98 *99 * @param sl Pointer to spinlock_t structure.100 */101 void spinlock_lock(spinlock_t *sl)102 {103 preemption_disable();104 105 /*106 * Each architecture has its own efficient/recommended107 * implementation of spinlock.108 */109 spinlock_arch(&sl->val);110 85 111 86 /* … … 144 119 } 145 120 146 /** Unlock spinlock147 *148 * Unlock spinlock.149 *150 * @param sl Pointer to spinlock_t structure.151 */152 void spinlock_unlock(spinlock_t *sl)153 {154 ASSERT(atomic_get(&sl->val) != 0);155 156 /*157 * Prevent critical section code from bleeding out this way down.158 */159 CS_LEAVE_BARRIER();160 161 atomic_set(&sl->val,0);162 preemption_enable();163 }164 165 121 #endif
Note:
See TracChangeset
for help on using the changeset viewer.