- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutines.c
r8118303 r8def349 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 14 15 // 15 16 17 #include "coroutines" 18 16 19 extern "C" { 17 20 #include <stddef.h> … … 23 26 } 24 27 25 #include " coroutines"28 #include "kernel" 26 29 #include "libhdr.h" 27 30 28 31 #define __CFA_INVOKE_PRIVATE__ 29 32 #include "invoke.h" 33 34 extern processor * get_this_processor(); 30 35 31 36 //----------------------------------------------------------------------------- … … 35 40 #define MinStackSize 1000 36 41 static size_t pageSize = 0; // architecture pagesize HACK, should go in proper runtime singleton 37 38 //Extra private desctructor for the main39 //FIXME the main should not actually allocate a stack40 //Since the main is never resumed the extra stack does not cause41 //any problem but it is wasted memory42 void ?{}(coStack_t* this, size_t size);43 void ?{}(coroutine* this, size_t size);44 45 //Main coroutine46 //FIXME do not construct a stack for the main47 coroutine main_coroutine = { 1000 };48 49 //Current coroutine50 //Will need to be in TLS when multi-threading is added51 coroutine* current_coroutine = &main_coroutine;52 42 53 43 //----------------------------------------------------------------------------- … … 111 101 // is not inline (We can't inline Cforall in C) 112 102 void suspend_no_inline(void) { 113 LIB_DEBUG_PRINTF("Suspending back : to %p from %p\n", this_coroutine(), this_coroutine() ? this_coroutine()->last : (void*)-1);114 115 103 suspend(); 116 104 } … … 123 111 124 112 // set new coroutine that task is executing 125 current_coroutine = dst;113 get_this_processor()->current_coroutine = dst; 126 114 127 115 // context switch to specified coroutine
Note:
See TracChangeset
for help on using the changeset viewer.