Changeset 39fea2f
- Timestamp:
- Sep 19, 2017, 3:11:44 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:
- 47b5b63, 764e009
- Parents:
- e06be49
- Location:
- src/libcfa/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine.c
re06be49 r39fea2f 65 65 this.errno_ = 0; 66 66 this.state = Start; 67 this.starter = NULL;67 this.starter = this_coroutine; 68 68 this.last = NULL; 69 69 } … … 171 171 suspend(); 172 172 } 173 174 void __leave_coroutine(void) { 175 coroutine_desc * src = this_coroutine; // optimization 176 177 assertf( src->starter != 0, 178 "Attempt to suspend coroutine \"%.256s\" (%p) that does not have a starter.\n" 179 "Possible cause is a resume of a coroutine already destroyed or not yet constructed", 180 src->name, src ); 181 assertf( src->starter->state != Halted, 182 "Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n" 183 "Possible cause is terminated coroutine's main routine has already returned.", 184 src->name, src, src->starter->name, src->starter ); 185 186 CoroutineCtxSwitch( src, src->starter ); 187 } 173 188 } 174 189 -
src/libcfa/concurrency/invoke.c
re06be49 r39fea2f 28 28 29 29 extern void __suspend_internal(void); 30 extern void __leave_coroutine(void); 30 31 extern void __leave_thread_monitor( struct thread_desc * this ); 31 32 extern void disable_interrupts(); … … 52 53 53 54 //Final suspend, should never return 54 __ suspend_internal();55 __leave_coroutine(); 55 56 abortf("Resumed dead coroutine"); 56 57 } -
src/libcfa/concurrency/invoke.h
re06be49 r39fea2f 80 80 int errno_; // copy of global UNIX variable errno 81 81 enum coroutine_state state; // current execution status for coroutine 82 struct coroutine_desc * starter;// first coroutine to resume this one83 struct coroutine_desc * last;// last coroutine to resume this one82 struct coroutine_desc * starter; // first coroutine to resume this one 83 struct coroutine_desc * last; // last coroutine to resume this one 84 84 }; 85 85 -
src/libcfa/concurrency/kernel.c
re06be49 r39fea2f 102 102 this.errno_ = 0; 103 103 this.state = Start; 104 this.starter = NULL; 104 105 } 105 106 … … 110 111 //----------------------------------------------------------------------------- 111 112 // Processor coroutine 113 114 // Construct the processor context of the main processor 112 115 void ?{}(processorCtx_t & this, processor * proc) { 113 116 (this.__cor){ "Processor" }; 117 this.__cor.starter = &mainThread->cor; 114 118 this.proc = proc; 115 119 proc->runner = &this; 116 120 } 117 121 122 // Construct the processor context of non-main processors 118 123 void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) { 119 124 (this.__cor){ info };
Note: See TracChangeset
for help on using the changeset viewer.