Changeset cd5b58f
- Timestamp:
- Oct 31, 2022, 3:00:01 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 7f3b5ce
- Parents:
- 637c139
- Location:
- libcfa/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/defs.hfa
r637c139 rcd5b58f 31 31 #define __cfa_anonymous_object(x) inline struct x 32 32 #define __cfa_dlink1(x) dlink(x) 33 #define __cfa_dlink2(x, name) inline struct name { inline dlink(x); } 33 34 #else 34 35 #define __cfa_anonymous_object(x) struct x __cfa_anonymous_object 35 36 #define __cfa_dlink1(x) struct { struct x * next; struct x * back; } 37 #define __cfa_dlink2(x, name) struct { struct x * next; struct x * back; } __dlink ## name 36 38 #endif 37 39 -
libcfa/src/concurrency/invoke.h
r637c139 rcd5b58f 195 195 struct __monitor_group_t monitors; 196 196 197 // used to put threads on dlist data structure 197 // intrusive link fields, used for locks, monitors and any user defined data structure 198 // default link fields for dlist 198 199 __cfa_dlink1(thread$) user_link; 199 200 200 struct { 201 struct thread$ * next; 202 struct thread$ * prev; 203 } node; 201 // secondary intrusive link fields, used for global cluster list 202 // default link fields for dlist 203 __cfa_dlink2(thread$, cltr_link); 204 204 205 205 // used to store state between clh lock/unlock … … 230 230 #ifdef __cforall 231 231 extern "Cforall" { 232 static inline thread$ * volatile & ?`next ( thread$ * this ) { 233 return this->user_link.next; 234 } 232 235 233 236 static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) { 234 237 return this.user_link.next; 235 }236 237 static inline [thread$ *&, thread$ *& ] __get( thread$ & this ) __attribute__((const)) {238 return this.node.[next, prev];239 238 } 240 239 … … 244 243 return result; 245 244 } 245 246 P9_EMBEDDED(thread$, thread$.cltr_link) 247 P9_EMBEDDED(thread$.cltr_link, dlink(thread$)) 246 248 247 249 static inline void ?{}(__monitor_group_t & this) { -
libcfa/src/concurrency/kernel.hfa
r637c139 rcd5b58f 256 256 // List of threads 257 257 __spinlock_t thread_list_lock; 258 __dllist_t(struct thread$) threads;258 dlist(struct thread$, thread$.cltr_link) threads; 259 259 unsigned int nthreads; 260 260 -
libcfa/src/concurrency/kernel/startup.cfa
r637c139 rcd5b58f 535 535 #endif 536 536 537 node.next = 0p;538 node.prev = 0p;539 537 doregister(curr_cluster, this); 540 538 … … 659 657 #endif 660 658 661 threads{ __get};659 threads{}; 662 660 663 661 io.arbiter = create(); … … 739 737 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 740 738 cltr->nthreads += 1; 741 push_front(cltr->threads, thrd);739 insert_first(cltr->threads, thrd); 742 740 unlock (cltr->thread_list_lock); 743 741 } … … 745 743 void unregister( cluster * cltr, thread$ & thrd ) { 746 744 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 747 remove(cltr->threads, thrd ); 748 cltr->nthreads -= 1; 745 { 746 tytagref( dlink(thread$), dlink(thread$) ) ?`inner( thread$ & this ) = void; 747 with( DLINK_VIA( thread$, thread$.cltr_link ) ) 748 remove( thrd ); 749 cltr->nthreads -= 1; 750 } 749 751 unlock(cltr->thread_list_lock); 750 752 } -
libcfa/src/concurrency/thread.cfa
r637c139 rcd5b58f 54 54 #endif 55 55 56 node.next = 0p;57 node.prev = 0p;58 59 56 clh_node = malloc( ); 60 57 *clh_node = false;
Note: See TracChangeset
for help on using the changeset viewer.