Changeset fc10e1b in mainline for kernel/generic/include/synch/spinlock.h
- Timestamp:
- 2018-09-07T16:34:11Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d2c91ab
- Parents:
- 508b0df1 (diff), e90cfa6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/spinlock.h
r508b0df1 rfc10e1b 36 36 #define KERN_SPINLOCK_H_ 37 37 38 #include <assert.h> 39 #include <stdatomic.h> 38 40 #include <stdbool.h> 39 #include <barrier.h>40 #include <assert.h>41 41 #include <preemption.h> 42 #include <atomic.h>43 42 #include <arch/asm.h> 44 43 … … 46 45 47 46 typedef struct spinlock { 48 atomic_ t val;47 atomic_flag flag; 49 48 50 49 #ifdef CONFIG_DEBUG_SPINLOCK … … 70 69 spinlock_t lock_name = { \ 71 70 .name = desc_name, \ 72 . val = { 0 }\71 .flag = ATOMIC_FLAG_INIT \ 73 72 } 74 73 … … 76 75 static spinlock_t lock_name = { \ 77 76 .name = desc_name, \ 78 . val = { 0 }\77 .flag = ATOMIC_FLAG_INIT \ 79 78 } 80 79 … … 89 88 #define SPINLOCK_INITIALIZE_NAME(lock_name, desc_name) \ 90 89 spinlock_t lock_name = { \ 91 . val = { 0 }\90 .flag = ATOMIC_FLAG_INIT \ 92 91 } 93 92 94 93 #define SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, desc_name) \ 95 94 static spinlock_t lock_name = { \ 96 . val = { 0 }\95 .flag = ATOMIC_FLAG_INIT \ 97 96 } 98 97 … … 126 125 NO_TRACE static inline void spinlock_unlock_nondebug(spinlock_t *lock) 127 126 { 128 /* 129 * Prevent critical section code from bleeding out this way down. 130 */ 131 CS_LEAVE_BARRIER(); 132 133 atomic_set(&lock->val, 0); 127 atomic_flag_clear_explicit(&lock->flag, memory_order_release); 134 128 preemption_enable(); 135 129 } … … 215 209 .lock = { \ 216 210 .name = desc_name, \ 217 . val = { 0 }\211 .flag = ATOMIC_FLAG_INIT \ 218 212 }, \ 219 213 .guard = false, \ … … 225 219 .lock = { \ 226 220 .name = desc_name, \ 227 . val = { 0 }\221 .flag = ATOMIC_FLAG_INIT \ 228 222 }, \ 229 223 .guard = false, \ … … 236 230 irq_spinlock_t lock_name = { \ 237 231 .lock = { \ 238 . val = { 0 }\232 .flag = ATOMIC_FLAG_INIT \ 239 233 }, \ 240 234 .guard = false, \ … … 245 239 static irq_spinlock_t lock_name = { \ 246 240 .lock = { \ 247 . val = { 0 }\241 .flag = ATOMIC_FLAG_INIT \ 248 242 }, \ 249 243 .guard = false, \
Note:
See TracChangeset
for help on using the changeset viewer.