- Timestamp:
- May 22, 2018, 4:39:48 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- 13073be, 2c88368
- Parents:
- 639991a
- Location:
- src/libcfa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/bits/containers.h
r639991a ra1a17a74 224 224 forall(dtype T | sized(T)) 225 225 static inline void push_front( __dllist(T) & this, T & node ) with( this ) { 226 verify(__get); 226 227 if ( head ) { 227 228 __get( node ).next = head; … … 246 247 forall(dtype T | sized(T)) 247 248 static inline void remove( __dllist(T) & this, T & node ) with( this ) { 249 verify(__get); 248 250 if ( &node == head ) { 249 251 if ( __get( *head ).next == head ) { -
src/libcfa/concurrency/kernel
r639991a ra1a17a74 145 145 __dllist_t(struct processor) idles; 146 146 147 // List of processors 148 __spinlock_t thread_list_lock; 149 __dllist_t(struct thread_desc) threads; 150 147 151 // Link lists fields 148 152 struct { -
src/libcfa/concurrency/kernel.c
r639991a ra1a17a74 49 49 thread_desc * mainThread; 50 50 51 struct { __dllist_t(thread_desc) list; __spinlock_t lock; } global_threads ;52 51 struct { __dllist_t(cluster ) list; __spinlock_t lock; } global_clusters; 53 52 … … 118 117 node.next = NULL; 119 118 node.prev = NULL; 120 doregister( this);119 doregister(curr_cluster, this); 121 120 122 121 monitors{ &self_mon_p, 1, (fptr_t)0 }; … … 167 166 procs{ __get }; 168 167 idles{ __get }; 168 threads{ __get }; 169 169 170 170 doregister(this); … … 518 518 __cfaabi_dbg_print_safe("Kernel : Starting\n"); 519 519 520 global_threads. list{ __get };521 global_threads. lock{};522 520 global_clusters.list{ __get }; 523 521 global_clusters.lock{}; … … 619 617 ^(mainThread){}; 620 618 619 ^(global_clusters.list){}; 620 ^(global_clusters.lock){}; 621 621 622 __cfaabi_dbg_print_safe("Kernel : Shutdown complete\n"); 622 623 } … … 756 757 //----------------------------------------------------------------------------- 757 758 // Global Queues 758 void doregister( thread_desc & thrd ) {759 lock ( global_threads.lock __cfaabi_dbg_ctx2);760 push_front( global_threads.list, thrd );761 unlock ( global_threads.lock );762 }763 764 void unregister( thread_desc & thrd ) {765 lock ( global_threads.lock __cfaabi_dbg_ctx2);766 remove( global_threads.list, thrd );767 unlock( global_threads.lock );768 }769 770 759 void doregister( cluster & cltr ) { 771 760 lock ( global_clusters.lock __cfaabi_dbg_ctx2); … … 780 769 } 781 770 771 void doregister( cluster * cltr, thread_desc & thrd ) { 772 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 773 push_front(cltr->threads, thrd); 774 unlock (cltr->thread_list_lock); 775 } 776 777 void unregister( cluster * cltr, thread_desc & thrd ) { 778 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 779 remove(cltr->threads, thrd ); 780 unlock(cltr->thread_list_lock); 781 } 782 782 783 783 void doregister( cluster * cltr, processor * proc ) { -
src/libcfa/concurrency/kernel_private.h
r639991a ra1a17a74 101 101 102 102 103 void doregister( struct thread_desc & thrd);104 void unregister( struct thread_desc & thrd);103 void doregister( struct cluster & cltr ); 104 void unregister( struct cluster & cltr ); 105 105 106 void doregister( struct cluster & cltr);107 void unregister( struct cluster & cltr);106 void doregister( struct cluster * cltr, struct thread_desc & thrd ); 107 void unregister( struct cluster * cltr, struct thread_desc & thrd ); 108 108 109 109 void doregister( struct cluster * cltr, struct processor * proc ); -
src/libcfa/concurrency/thread.c
r639991a ra1a17a74 42 42 node.next = NULL; 43 43 node.prev = NULL; 44 doregister( this);44 doregister(curr_cluster, this); 45 45 46 46 monitors{ &self_mon_p, 1, (fptr_t)0 }; … … 48 48 49 49 void ^?{}(thread_desc& this) with( this ) { 50 unregister( this);50 unregister(curr_cluster, this); 51 51 ^self_cor{}; 52 52 }
Note: See TracChangeset
for help on using the changeset viewer.