Changeset 0348fd8 for libcfa/src
- Timestamp:
- Jan 4, 2023, 1:43:50 PM (20 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- d99a716
- Parents:
- df9e412
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/invoke.h
rdf9e412 r0348fd8 215 215 struct __thread_user_link cltr_link; 216 216 217 // used to store state between clh lock/unlock218 volatile bool * clh_prev;219 220 217 // used to point to this thd's current clh node 221 218 volatile bool * clh_node; -
libcfa/src/concurrency/locks.hfa
rdf9e412 r0348fd8 228 228 struct clh_lock { 229 229 volatile bool * volatile tail; 230 volatile bool * volatile head; 230 231 }; 231 232 … … 237 238 *(curr_thd->clh_node) = false; 238 239 volatile bool * prev = __atomic_exchange_n((bool **)(&l.tail), (bool *)(curr_thd->clh_node), __ATOMIC_SEQ_CST); 239 while(!__atomic_load_n(prev, __ATOMIC_ACQUIRE)) Pause(); 240 curr_thd->clh_prev = prev; 240 while(!__atomic_load_n(prev, __ATOMIC_SEQ_CST)) Pause(); 241 __atomic_store_n((bool **)(&l.head), (bool *)curr_thd->clh_node, __ATOMIC_SEQ_CST); 242 curr_thd->clh_node = prev; 241 243 } 242 244 243 245 static inline void unlock(clh_lock & l) { 244 thread$ * curr_thd = active_thread(); 245 __atomic_store_n(curr_thd->clh_node, true, __ATOMIC_RELEASE); 246 curr_thd->clh_node = curr_thd->clh_prev; 246 __atomic_store_n((bool *)(l.head), true, __ATOMIC_SEQ_CST); 247 247 } 248 248
Note: See TracChangeset
for help on using the changeset viewer.