Changeset 76a798d for libcfa/src/concurrency
- Timestamp:
- Jun 16, 2022, 2:47:50 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 9e23b446, df932552
- Parents:
- 9e3d123
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.hfa
r9e3d123 r76a798d 126 126 static inline void lock(mcs_spin_lock & l, mcs_spin_node & n) { 127 127 mcs_spin_node * prev = __atomic_exchange_n(&l.queue.tail, &n, __ATOMIC_SEQ_CST); 128 n.locked = true; 128 129 if(prev == 0p) return; 129 130 prev->next = &n; 130 while(__atomic_load_n(&n.locked, __ATOMIC_ SEQ_CST)) Pause();131 while(__atomic_load_n(&n.locked, __ATOMIC_RELAXED)) Pause(); 131 132 } 132 133 … … 134 135 mcs_spin_node * n_ptr = &n; 135 136 if (__atomic_compare_exchange_n(&l.queue.tail, &n_ptr, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) return; 136 while (__atomic_load_n(&n.next, __ATOMIC_ SEQ_CST) == 0p) {}137 while (__atomic_load_n(&n.next, __ATOMIC_RELAXED) == 0p) {} 137 138 n.next->locked = false; 138 139 }
Note: See TracChangeset
for help on using the changeset viewer.