Changeset 8cfa4ef for libcfa/src/concurrency/kernel/startup.cfa
- Timestamp:
- Apr 15, 2021, 12:05:16 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8590328
- Parents:
- 2f5ea69 (diff), a4b0aa4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/startup.cfa
r2f5ea69 r8cfa4ef 469 469 this.name = name; 470 470 this.cltr = &_cltr; 471 this.cltr_id = -1u; 471 472 do_terminate = false; 472 473 preemption_alarm = 0p; … … 489 490 #endif 490 491 491 lock( this.cltr->idles ); 492 int target = this.cltr->idles.total += 1u; 493 unlock( this.cltr->idles ); 494 495 id = doregister((__processor_id_t*)&this); 496 492 // Register and Lock the RWlock so no-one pushes/pops while we are changing the queue 493 uint_fast32_t last_size = ready_mutate_register((__processor_id_t*)&this); 494 this.cltr->procs.total += 1u; 495 insert_last(this.cltr->procs.actives, this); 496 497 // Adjust the ready queue size 498 ready_queue_grow( cltr ); 499 500 // Unlock the RWlock 501 ready_mutate_unlock( last_size ); 502 503 __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this); 504 } 505 506 // Not a ctor, it just preps the destruction but should not destroy members 507 static void deinit(processor & this) { 497 508 // Lock the RWlock so no-one pushes/pops while we are changing the queue 498 509 uint_fast32_t last_size = ready_mutate_lock(); 510 this.cltr->procs.total -= 1u; 511 remove(this); 499 512 500 513 // Adjust the ready queue size 501 this.cltr_id = ready_queue_grow( cltr, target ); 502 503 // Unlock the RWlock 504 ready_mutate_unlock( last_size ); 505 506 __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this); 507 } 508 509 // Not a ctor, it just preps the destruction but should not destroy members 510 static void deinit(processor & this) { 511 lock( this.cltr->idles ); 512 int target = this.cltr->idles.total -= 1u; 513 unlock( this.cltr->idles ); 514 515 // Lock the RWlock so no-one pushes/pops while we are changing the queue 516 uint_fast32_t last_size = ready_mutate_lock(); 517 518 // Adjust the ready queue size 519 ready_queue_shrink( this.cltr, target ); 520 521 // Unlock the RWlock 522 ready_mutate_unlock( last_size ); 523 524 // Finally we don't need the read_lock any more 525 unregister((__processor_id_t*)&this); 514 ready_queue_shrink( this.cltr ); 515 516 // Unlock the RWlock and unregister: we don't need the read_lock any more 517 ready_mutate_unregister((__processor_id_t*)&this, last_size ); 526 518 527 519 close(this.idle); … … 566 558 //----------------------------------------------------------------------------- 567 559 // Cluster 568 static void ?{}(__cluster_ idles& this) {560 static void ?{}(__cluster_proc_list & this) { 569 561 this.lock = 0; 570 562 this.idle = 0; 571 563 this.total = 0; 572 (this.list){};573 564 } 574 565 … … 596 587 597 588 // Adjust the ready queue size 598 ready_queue_grow( &this , 0);589 ready_queue_grow( &this ); 599 590 600 591 // Unlock the RWlock … … 611 602 612 603 // Adjust the ready queue size 613 ready_queue_shrink( &this , 0);604 ready_queue_shrink( &this ); 614 605 615 606 // Unlock the RWlock
Note: See TracChangeset
for help on using the changeset viewer.