Changeset ee897e4b for src/libcfa
- Timestamp:
- Feb 13, 2017, 5:13:11 PM (8 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:
- eafb094
- Parents:
- db6f06a
- Location:
- src/libcfa/concurrency
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutines
rdb6f06a ree897e4b 77 77 "Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.", 78 78 src->name, src ); 79 assertf( src->last-> notHalted,79 assertf( src->last->state != Halted, 80 80 "Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n" 81 81 "Possible cause is terminated coroutine's main routine has already returned.", … … 98 98 // not resuming self ? 99 99 if ( src != dst ) { 100 assertf( dst-> notHalted ,100 assertf( dst->state != Halted , 101 101 "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n" 102 102 "Possible cause is terminated coroutine's main routine has already returned.", … … 116 116 // not resuming self ? 117 117 if ( src != dst ) { 118 assertf( dst-> notHalted ,118 assertf( dst->state != Halted , 119 119 "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n" 120 120 "Possible cause is terminated coroutine's main routine has already returned.", -
src/libcfa/concurrency/coroutines.c
rdb6f06a ree897e4b 68 68 this->errno_ = 0; 69 69 this->state = Start; 70 this->notHalted = true;71 70 this->starter = NULL; 72 71 this->last = NULL; -
src/libcfa/concurrency/invoke.c
rdb6f06a ree897e4b 48 48 main( this ); 49 49 50 cor->state = Halt; 51 cor->notHalted = false; 50 cor->state = Halted; 52 51 53 52 //Final suspend, should never return -
src/libcfa/concurrency/invoke.h
rdb6f06a ree897e4b 39 39 }; 40 40 41 // struct simple_lock {42 // struct simple_thread_list blocked;43 // };44 45 41 struct signal_once { 46 42 volatile bool condition; … … 54 50 void append( struct simple_thread_list *, struct thread * ); 55 51 struct thread * pop_head( struct simple_thread_list * ); 56 57 // void ?{}(simple_lock * this);58 // void ^?{}(simple_lock * this);59 52 60 53 void ?{}(spinlock * this); … … 76 69 }; 77 70 78 enum coroutine_state { Start, Inactive, Active, Halt, Primed };71 enum coroutine_state { Halted, Start, Inactive, Active, Primed }; 79 72 80 73 struct coroutine { … … 83 76 int errno_; // copy of global UNIX variable errno 84 77 enum coroutine_state state; // current execution status for coroutine 85 bool notHalted; // indicate if execuation state is not halted86 78 struct coroutine *starter; // first coroutine to resume this one 87 79 struct coroutine *last; // last coroutine to resume this one … … 89 81 90 82 struct thread { 91 struct coroutine c; 92 s ignal_once terminated;// indicate if execuation state is not halted93 struct thread * next; 83 struct coroutine c; // coroutine body used to store context 84 struct signal_once terminated;// indicate if execuation state is not halted 85 struct thread * next; // instrusive link field for threads 94 86 }; 95 87 -
src/libcfa/concurrency/kernel.c
rdb6f06a ree897e4b 119 119 this->name = "Main Thread"; 120 120 this->errno_ = 0; 121 this->state = Inactive; 122 this->notHalted = true; 121 this->state = Start; 123 122 } 124 123 … … 287 286 proc_cor_storage.c.state = Active; 288 287 main( &proc_cor_storage ); 289 proc_cor_storage.c.state = Halt; 290 proc_cor_storage.c.notHalted = false; 288 proc_cor_storage.c.state = Halted; 291 289 292 290 // Main routine of the core returned, the core is now fully terminated -
src/libcfa/concurrency/threads.c
rdb6f06a ree897e4b 120 120 extern "C" { 121 121 void __thread_signal_termination( thread * this ) { 122 this->c.state = Halt ;122 this->c.state = Halted; 123 123 LIB_DEBUG_PRINTF("Thread end : %p\n", this); 124 124 signal( &this->terminated );
Note: See TracChangeset
for help on using the changeset viewer.