Changes in / [cb94e41:edc4813]
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/channel.hfa
rcb94e41 redc4813 28 28 unlock( lock ); 29 29 park(); 30 #if defined(__ARM_ARCH) 30 31 __atomic_thread_fence( __ATOMIC_SEQ_CST ); 32 #endif 31 33 return sn.extra == 0p; 32 34 } … … 131 133 static inline void __cons_handoff( channel(T) & chan, T & elem ) with(chan) { 132 134 memcpy( cons`first.extra, (void *)&elem, sizeof(T) ); // do waiting consumer work 135 #if defined(__ARM_ARCH) 133 136 __atomic_thread_fence( __ATOMIC_SEQ_CST ); 137 #endif 134 138 wake_one( cons ); 135 139 } … … 138 142 static inline void __prods_handoff( channel(T) & chan, T & retval ) with(chan) { 139 143 memcpy( (void *)&retval, prods`first.extra, sizeof(T) ); 144 #if defined(__ARM_ARCH) 140 145 __atomic_thread_fence( __ATOMIC_SEQ_CST ); 146 #endif 141 147 wake_one( prods ); 142 148 } -
libcfa/src/concurrency/locks.hfa
rcb94e41 redc4813 182 182 static inline void lock( mcs_spin_lock & l, mcs_spin_node & n ) { 183 183 n.locked = true; 184 185 #if defined(__ARM_ARCH) 186 __asm__ __volatile__ ( "DMB ISH" ::: ); 187 #endif 188 184 189 mcs_spin_node * prev = __atomic_exchange_n(&l.queue.tail, &n, __ATOMIC_SEQ_CST); 185 190 if( prev == 0p ) return; 186 191 prev->next = &n; 192 193 #if defined(__ARM_ARCH) 194 __asm__ __volatile__ ( "DMB ISH" ::: ); 195 #endif 196 187 197 while( __atomic_load_n(&n.locked, __ATOMIC_RELAXED) ) Pause(); 198 199 #if defined(__ARM_ARCH) 200 __asm__ __volatile__ ( "DMB ISH" ::: ); 201 #endif 188 202 } 189 203 190 204 static inline void unlock(mcs_spin_lock & l, mcs_spin_node & n) { 205 #if defined(__ARM_ARCH) 206 __asm__ __volatile__ ( "DMB ISH" ::: ); 207 #endif 208 191 209 mcs_spin_node * n_ptr = &n; 192 210 if (__atomic_compare_exchange_n(&l.queue.tail, &n_ptr, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) return; 193 211 while (__atomic_load_n(&n.next, __ATOMIC_RELAXED) == 0p) Pause(); 212 213 #if defined(__ARM_ARCH) 214 __asm__ __volatile__ ( "DMB ISH" ::: ); 215 #endif 216 194 217 n.next->locked = false; 195 218 }
Note: See TracChangeset
for help on using the changeset viewer.