- File:
-
- 1 edited
-
src/libcfa/concurrency/invoke.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/invoke.h
ree897e4b r0157ca7 30 30 #define SCHEDULER_CAPACITY 10 31 31 32 struct spinlock {33 volatile int lock;34 };35 36 32 struct simple_thread_list { 37 33 struct thread * head; 38 34 struct thread ** tail; 39 };40 41 struct signal_once {42 volatile bool condition;43 struct spinlock lock;44 struct simple_thread_list blocked;45 35 }; 46 36 … … 50 40 void append( struct simple_thread_list *, struct thread * ); 51 41 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);58 42 } 59 43 #endif … … 69 53 }; 70 54 71 enum coroutine_state { Halted, Start, Inactive, Active, Primed };55 enum coroutine_state { Start, Inactive, Active, Halt, Primed }; 72 56 73 57 struct coroutine { … … 76 60 int errno_; // copy of global UNIX variable errno 77 61 enum coroutine_state state; // current execution status for coroutine 62 bool notHalted; // indicate if execuation state is not halted 63 78 64 struct coroutine *starter; // first coroutine to resume this one 79 65 struct coroutine *last; // last coroutine to resume this one 80 66 }; 81 67 68 struct simple_lock { 69 struct simple_thread_list blocked; 70 }; 71 82 72 struct thread { 83 struct coroutine c; // coroutine body used to store context84 struct si gnal_once terminated;// indicate if execuation state is not halted85 struct thread * next; // instrusive link field for threads73 struct coroutine c; 74 struct simple_lock lock; 75 struct thread * next; 86 76 }; 87 77
Note:
See TracChangeset
for help on using the changeset viewer.