// -*- Mode: CFA -*- // // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // kernel.c -- // // Author : Thierry Delisle // Created On : Tue Jan 17 12:27:26 2016 // Last Modified By : Thierry Delisle // Last Modified On : -- // Update Count : 0 // //Header #include "kernel" //C Includes #include //CFA Includes #include "libhdr.h" #include "threads" //Private includes #define __CFA_INVOKE_PRIVATE__ #include "invoke.h" thread_h * the_thread = 0; void kernel_run( void ) { bool done = true; coroutine* processor_cor = this_coroutine(); LIB_DEBUG_PRINTF("Kernel : processor cor is %p\n", processor_cor); do { thread_h * dst = the_thread; LIB_DEBUG_PRINTF("Kernel : picked thread %p\n", dst); // set new coroutine that task is executing current_coroutine = &dst->c; // context switch to specified coroutine LIB_DEBUG_PRINTF("Kernel : switching to ctx %p (from %p)\n", current_coroutine, processor_cor); CtxSwitch( processor_cor->stack.context, current_coroutine->stack.context ); // when CtxSwitch returns we are back in the processor coroutine } while( ! done ); } // Local Variables: // // mode: c // // tab-width: 4 // // End: //