Changeset d3a804f5 for src/libcfa/concurrency/invoke.h
- Timestamp:
- Feb 14, 2017, 1:19:28 PM (9 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:
- 97d246d
- Parents:
- f923b5f (diff), eafb094 (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/invoke.h
rf923b5f rd3a804f5 30 30 #define SCHEDULER_CAPACITY 10 31 31 32 struct spinlock { 33 volatile int lock; 34 }; 35 32 36 struct simple_thread_list { 33 37 struct thread * head; 34 38 struct thread ** tail; 39 }; 40 41 struct signal_once { 42 volatile bool condition; 43 struct spinlock lock; 44 struct simple_thread_list blocked; 35 45 }; 36 46 … … 40 50 void append( struct simple_thread_list *, struct thread * ); 41 51 struct thread * pop_head( struct simple_thread_list * ); 52 53 void ?{}(spinlock * this); 54 void ^?{}(spinlock * this); 55 56 void ?{}(signal_once * this); 57 void ^?{}(signal_once * this); 42 58 } 43 59 #endif … … 53 69 }; 54 70 55 enum coroutine_state { Start, Inactive, Active, Halt, Primed };71 enum coroutine_state { Halted, Start, Inactive, Active, Primed }; 56 72 57 73 struct coroutine { … … 60 76 int errno_; // copy of global UNIX variable errno 61 77 enum coroutine_state state; // current execution status for coroutine 62 bool notHalted; // indicate if execuation state is not halted63 64 78 struct coroutine *starter; // first coroutine to resume this one 65 79 struct coroutine *last; // last coroutine to resume this one 66 80 }; 67 81 68 struct simple_lock {69 struct simple_thread_list blocked;70 };71 72 82 struct thread { 73 struct coroutine c; 74 struct si mple_lock lock;75 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 76 86 }; 77 87
Note:
See TracChangeset
for help on using the changeset viewer.