Changeset 13c5e19 for libcfa/src/concurrency/kernel.cfa
- Timestamp:
- Jun 23, 2020, 4:42:58 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- de917da3
- Parents:
- b232745
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
rb232745 r13c5e19 229 229 static void * __invoke_processor(void * arg); 230 230 231 void ?{}(processor & this, const char name[], cluster & cltr) with( this ) {231 void ?{}(processor & this, const char name[], cluster & _cltr) with( this ) { 232 232 this.name = name; 233 this.cltr = & cltr;233 this.cltr = &_cltr; 234 234 id = -1u; 235 235 terminated{ 0 }; … … 245 245 246 246 this.stack = __create_pthread( &this.kernel_thread, __invoke_processor, (void *)&this ); 247 __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST ); 247 248 248 249 __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this); … … 264 265 265 266 free( this.stack ); 267 268 __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST ); 266 269 } 267 270 … … 269 272 this.name = name; 270 273 this.preemption_rate = preemption_rate; 274 this.nprocessors = 0; 271 275 ready_queue{}; 272 276 … … 324 328 } 325 329 326 doregister(this->cltr, this);327 328 330 { 329 331 // Setup preemption data … … 357 359 __cfadbg_print_safe(runtime_core, "Kernel : core %p stopping\n", this); 358 360 } 359 360 unregister(this->cltr, this);361 361 362 362 V( this->terminated ); … … 845 845 runner{ &this }; 846 846 __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner); 847 848 __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST ); 847 849 } 848 850 … … 918 920 void ^?{}(processor & this) with( this ){ 919 921 /* paranoid */ verify( this.do_terminate == true ); 922 __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST ); 920 923 __cfaabi_dbg_print_safe("Kernel : destroyed main processor context %p\n", &runner); 921 924 } … … 1150 1153 } 1151 1154 1152 void doregister( cluster * cltr, processor * proc ) {1153 // lock (cltr->idle_lock __cfaabi_dbg_ctx2);1154 // cltr->nprocessors += 1;1155 // push_front(cltr->procs, *proc);1156 // unlock (cltr->idle_lock);1157 }1158 1159 void unregister( cluster * cltr, processor * proc ) {1160 // lock (cltr->idle_lock __cfaabi_dbg_ctx2);1161 // remove(cltr->procs, *proc );1162 // cltr->nprocessors -= 1;1163 // unlock(cltr->idle_lock);1164 }1165 1166 1155 //----------------------------------------------------------------------------- 1167 1156 // Debug
Note: See TracChangeset
for help on using the changeset viewer.