Changeset 8b74fa7 for libcfa/src/concurrency/kernel
- Timestamp:
- Oct 27, 2022, 11:20:19 AM (22 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- a167c70c
- Parents:
- 878cfcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/startup.cfa
r878cfcc r8b74fa7 16 16 #define __cforall_thread__ 17 17 #define _GNU_SOURCE 18 19 // #define __CFA_DEBUG_PRINT_RUNTIME_CORE__ 18 20 19 21 // C Includes … … 336 338 337 339 /* paranoid */ verify( this.do_terminate == true ); 338 __cfa abi_dbg_print_safe("Kernel : destroyed main processor context %p\n", &runner);340 __cfadbg_print_safe(runtime_core, "Kernel : destroyed main processor context %p\n", &runner); 339 341 } 340 342 … … 397 399 (proc->runner){ proc, &info }; 398 400 399 __cfa abi_dbg_print_safe("Coroutine : created stack %p\n", get_coroutine(proc->runner)->stack.storage);401 __cfadbg_print_safe(runtime_core, "Coroutine : created stack %p\n", get_coroutine(proc->runner)->stack.storage); 400 402 401 403 //Set global state … … 662 664 io.params = io_params; 663 665 666 managed.procs = 0p; 667 managed.cnt = 0; 668 664 669 doregister(this); 665 670 … … 677 682 678 683 void ^?{}(cluster & this) libcfa_public { 684 set_concurrency( this, 0 ); 685 679 686 destroy(this.io.arbiter); 680 687 … … 848 855 } 849 856 857 unsigned set_concurrency( cluster & this, unsigned new ) libcfa_public { 858 unsigned old = this.managed.cnt; 859 860 __cfadbg_print_safe(runtime_core, "Kernel : resizing cluster from %u to %u\n", old, (unsigned)new); 861 862 // Delete all the old unneeded procs 863 if(old > new) for(i; (unsigned)new ~ old) { 864 __cfadbg_print_safe(runtime_core, "Kernel : destroying %u\n", i); 865 delete( this.managed.procs[i] ); 866 } 867 868 // Allocate new array (uses realloc and memcpies the data) 869 this.managed.procs = alloc( new, this.managed.procs`realloc ); 870 this.managed.cnt = new; 871 872 // Create the desired new procs 873 if(old < new) for(i; old ~ new) { 874 __cfadbg_print_safe(runtime_core, "Kernel : constructing %u\n", i); 875 (*(this.managed.procs[i] = alloc())){ this }; 876 } 877 878 // return the old count 879 return old; 880 } 881 850 882 #if defined(__CFA_WITH_VERIFY__) 851 883 static bool verify_fwd_bck_rng(void) {
Note: See TracChangeset
for help on using the changeset viewer.