Changeset 3bbd012 for src/libcfa/concurrency/kernel.c
- Timestamp:
- Jul 31, 2018, 2:43:04 PM (6 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, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 642bc83
- Parents:
- d1e0979 (diff), 04e367c (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
-
src/libcfa/concurrency/kernel.c
rd1e0979 r3bbd012 37 37 38 38 //Start and stop routine for the kernel, declared first to make sure they run first 39 void kernel_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));40 void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));39 static void kernel_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) )); 40 static void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) )); 41 41 42 42 //----------------------------------------------------------------------------- … … 133 133 134 134 // Construct the processor context of non-main processors 135 void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {135 static void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) { 136 136 (this.__cor){ info }; 137 137 this.proc = proc; 138 138 } 139 139 140 static void start(processor * this); 140 141 void ?{}(processor & this, const char * name, cluster & cltr) with( this ) { 141 142 this.name = name; … … 186 187 // Kernel Scheduling logic 187 188 //============================================================================================= 189 static void runThread(processor * this, thread_desc * dst); 190 static void finishRunning(processor * this); 191 static void halt(processor * this); 192 188 193 //Main of the processor contexts 189 194 void main(processorCtx_t & runner) { … … 239 244 // runThread runs a thread by context switching 240 245 // from the processor coroutine to the target thread 241 void runThread(processor * this, thread_desc * dst) {246 static void runThread(processor * this, thread_desc * dst) { 242 247 assert(dst->curr_cor); 243 248 coroutine_desc * proc_cor = get_coroutine(this->runner); … … 256 261 257 262 // KERNEL_ONLY 258 void returnToKernel() {263 static void returnToKernel() { 259 264 coroutine_desc * proc_cor = get_coroutine(kernelTLS.this_processor->runner); 260 265 coroutine_desc * thrd_cor = kernelTLS.this_thread->curr_cor = kernelTLS.this_coroutine; … … 265 270 // Once a thread has finished running, some of 266 271 // its final actions must be executed from the kernel 267 void finishRunning(processor * this) with( this->finish ) {272 static void finishRunning(processor * this) with( this->finish ) { 268 273 verify( ! kernelTLS.preemption_state.enabled ); 269 274 choose( action_code ) { … … 299 304 // This is the entry point for processors (kernel threads) 300 305 // It effectively constructs a coroutine by stealing the pthread stack 301 void * CtxInvokeProcessor(void * arg) {306 static void * CtxInvokeProcessor(void * arg) { 302 307 processor * proc = (processor *) arg; 303 308 kernelTLS.this_processor = proc; … … 336 341 } 337 342 338 void start(processor * this) {343 static void start(processor * this) { 339 344 __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this); 340 345 … … 542 547 //----------------------------------------------------------------------------- 543 548 // Kernel boot procedures 544 void kernel_startup(void) {549 static void kernel_startup(void) { 545 550 verify( ! kernelTLS.preemption_state.enabled ); 546 551 __cfaabi_dbg_print_safe("Kernel : Starting\n"); … … 618 623 } 619 624 620 void kernel_shutdown(void) {625 static void kernel_shutdown(void) { 621 626 __cfaabi_dbg_print_safe("\n--------------------------------------------------\nKernel : Shutting down\n"); 622 627 … … 655 660 // Kernel Quiescing 656 661 //============================================================================================= 657 658 void halt(processor * this) with( *this ) { 662 static void halt(processor * this) with( *this ) { 659 663 // verify( ! __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) ); 660 664 … … 683 687 // Unexpected Terminating logic 684 688 //============================================================================================= 685 686 687 689 static __spinlock_t kernel_abort_lock; 688 690 static bool kernel_abort_called = false;
Note: See TracChangeset
for help on using the changeset viewer.