- File:
-
- 1 edited
-
src/libcfa/concurrency/invoke.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/invoke.h
r0157ca7 ree897e4b 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.