Changeset 348006f for src/libcfa/concurrency/kernel.c
- Timestamp:
- Mar 15, 2017, 4:20:26 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, resolv-new, with_gc
- Children:
- 29f44a74
- Parents:
- 84c52a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel.c
r84c52a8 r348006f 43 43 KERNEL_STORAGE(cluster, systemCluster); 44 44 KERNEL_STORAGE(processor, systemProcessor); 45 KERNEL_STORAGE(thread , mainThread);45 KERNEL_STORAGE(thread_desc, mainThread); 46 46 KERNEL_STORAGE(machine_context_t, mainThread_context); 47 47 48 48 cluster * systemCluster; 49 49 processor * systemProcessor; 50 thread * mainThread;50 thread_desc * mainThread; 51 51 52 52 //----------------------------------------------------------------------------- … … 59 59 } 60 60 61 thread * this_thread(void) {61 thread_desc * this_thread(void) { 62 62 return this_processor->current_thread; 63 63 } … … 106 106 } 107 107 108 void ?{}( thread * this, current_stack_info_t * info) {108 void ?{}( thread_desc * this, current_stack_info_t * info) { 109 109 (&this->c){ info }; 110 110 } … … 175 175 LIB_DEBUG_PRINTF("Kernel : core %p starting\n", this); 176 176 177 thread * readyThread = NULL;177 thread_desc * readyThread = NULL; 178 178 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ ) 179 179 { … … 202 202 // runThread runs a thread by context switching 203 203 // from the processor coroutine to the target thread 204 void runThread(processor * this, thread * dst) {204 void runThread(processor * this, thread_desc * dst) { 205 205 coroutine_desc * proc_cor = get_coroutine(this->runner); 206 206 coroutine_desc * thrd_cor = get_coroutine(dst); … … 293 293 //----------------------------------------------------------------------------- 294 294 // Scheduler routines 295 void ScheduleThread( thread * thrd ) {295 void ScheduleThread( thread_desc * thrd ) { 296 296 assertf( thrd->next == NULL, "Expected null got %p", thrd->next ); 297 297 … … 301 301 } 302 302 303 thread * nextThread(cluster * this) {303 thread_desc * nextThread(cluster * this) { 304 304 lock( &this->lock ); 305 thread * head = pop_head( &this->ready_queue );305 thread_desc * head = pop_head( &this->ready_queue ); 306 306 unlock( &this->lock ); 307 307 return head; … … 318 318 } 319 319 320 void ScheduleInternal( thread * thrd ) {320 void ScheduleInternal( thread_desc * thrd ) { 321 321 this_processor->finish.action_code = Schedule; 322 322 this_processor->finish.thrd = thrd; … … 324 324 } 325 325 326 void ScheduleInternal( spinlock * lock, thread * thrd ) {326 void ScheduleInternal( spinlock * lock, thread_desc * thrd ) { 327 327 this_processor->finish.action_code = Release_Schedule; 328 328 this_processor->finish.lock = lock; … … 339 339 // SKULLDUGGERY: the mainThread steals the process main thread 340 340 // which will then be scheduled by the systemProcessor normally 341 mainThread = (thread *)&mainThread_storage;341 mainThread = (thread_desc *)&mainThread_storage; 342 342 current_stack_info_t info; 343 343 mainThread{ &info }; … … 436 436 this->condition = true; 437 437 438 thread * it;438 thread_desc * it; 439 439 while( it = pop_head( &this->blocked) ) { 440 440 ScheduleThread( it ); … … 451 451 } 452 452 453 void append( simple_thread_list * this, thread * t ) {453 void append( simple_thread_list * this, thread_desc * t ) { 454 454 assert(this->tail != NULL); 455 455 *this->tail = t; … … 457 457 } 458 458 459 thread * pop_head( simple_thread_list * this ) {460 thread * head = this->head;459 thread_desc * pop_head( simple_thread_list * this ) { 460 thread_desc * head = this->head; 461 461 if( head ) { 462 462 this->head = head->next;
Note: See TracChangeset
for help on using the changeset viewer.