Changeset 24e321c for libcfa/src/concurrency/kernel
- Timestamp:
- Sep 23, 2021, 2:18:01 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 75c7252
- Parents:
- fcd65ca
- Location:
- libcfa/src/concurrency/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/fwd.hfa
rfcd65ca r24e321c 119 119 120 120 extern "Cforall" { 121 enum unpark_hint { UNPARK_LOCAL, UNPARK_REMOTE }; 122 121 123 extern void park( void ); 122 extern void unpark( struct thread$ * this ); 124 extern void unpark( struct thread$ *, unpark_hint ); 125 static inline void unpark( struct thread$ * thrd ) { unpark(thrd, UNPARK_LOCAL); } 123 126 static inline struct thread$ * active_thread () { 124 127 struct thread$ * t = publicTLS_get( this_thread ); -
libcfa/src/concurrency/kernel/startup.cfa
rfcd65ca r24e321c 200 200 __cfadbg_print_safe(runtime_core, "Kernel : Main cluster ready\n"); 201 201 202 // Construct the processor context of the main processor 203 void ?{}(processorCtx_t & this, processor * proc) { 204 (this.__cor){ "Processor" }; 205 this.__cor.starter = 0p; 206 this.proc = proc; 207 } 208 209 void ?{}(processor & this) with( this ) { 210 ( this.terminated ){}; 211 ( this.runner ){}; 212 init( this, "Main Processor", *mainCluster, 0p ); 213 kernel_thread = pthread_self(); 214 215 runner{ &this }; 216 __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner); 217 } 218 219 // Initialize the main processor and the main processor ctx 220 // (the coroutine that contains the processing control flow) 221 mainProcessor = (processor *)&storage_mainProcessor; 222 (*mainProcessor){}; 223 224 register_tls( mainProcessor ); 225 202 226 // Start by initializing the main thread 203 227 // SKULLDUGGERY: the mainThread steals the process main thread … … 210 234 __cfadbg_print_safe(runtime_core, "Kernel : Main thread ready\n"); 211 235 212 213 214 // Construct the processor context of the main processor215 void ?{}(processorCtx_t & this, processor * proc) {216 (this.__cor){ "Processor" };217 this.__cor.starter = 0p;218 this.proc = proc;219 }220 221 void ?{}(processor & this) with( this ) {222 ( this.terminated ){};223 ( this.runner ){};224 init( this, "Main Processor", *mainCluster, 0p );225 kernel_thread = pthread_self();226 227 runner{ &this };228 __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner);229 }230 231 // Initialize the main processor and the main processor ctx232 // (the coroutine that contains the processing control flow)233 mainProcessor = (processor *)&storage_mainProcessor;234 (*mainProcessor){};235 236 register_tls( mainProcessor );237 238 236 //initialize the global state variables 239 237 __cfaabi_tls.this_processor = mainProcessor; … … 251 249 // Add the main thread to the ready queue 252 250 // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread 253 schedule_thread$(mainThread );251 schedule_thread$(mainThread, UNPARK_LOCAL); 254 252 255 253 // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX … … 485 483 link.next = 0p; 486 484 link.ts = -1llu; 487 preferred = -1u;485 preferred = ready_queue_new_preferred(); 488 486 last_proc = 0p; 489 487 #if defined( __CFA_WITH_VERIFY__ )
Note: See TracChangeset
for help on using the changeset viewer.