Changeset 22f94a4 for libcfa/src/concurrency/invoke.h
- Timestamp:
- Aug 11, 2020, 4:40:15 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0d070ca
- Parents:
- 07d867b (diff), 129674b (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
-
libcfa/src/concurrency/invoke.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/invoke.h
r07d867b r22f94a4 17 17 #include "bits/defs.hfa" 18 18 #include "bits/locks.hfa" 19 #include "kernel/fwd.hfa" 19 20 20 21 #ifdef __cforall … … 25 26 #ifndef _INVOKE_H_ 26 27 #define _INVOKE_H_ 27 28 #ifdef __ARM_ARCH29 // function prototypes are only really used by these macros on ARM30 void disable_global_interrupts();31 void enable_global_interrupts();32 33 #define TL_GET( member ) ( { __typeof__( kernelTLS.member ) target; \34 disable_global_interrupts(); \35 target = kernelTLS.member; \36 enable_global_interrupts(); \37 target; } )38 #define TL_SET( member, value ) disable_global_interrupts(); \39 kernelTLS.member = value; \40 enable_global_interrupts();41 #else42 #define TL_GET( member ) kernelTLS.member43 #define TL_SET( member, value ) kernelTLS.member = value;44 #endif45 46 #ifdef __cforall47 extern "Cforall" {48 extern __attribute__((aligned(128))) thread_local struct KernelThreadData {49 struct $thread * volatile this_thread;50 struct processor * volatile this_processor;51 52 struct {53 volatile unsigned short disable_count;54 volatile bool enabled;55 volatile bool in_progress;56 } preemption_state;57 58 uint32_t rand_seed;59 } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));60 }61 #endif62 28 63 29 struct __stack_context_t { … … 92 58 }; 93 59 94 enum coroutine_state { Halted, Start, Primed, Blocked, Ready, Active, Rerun }; 95 enum __Preemption_Reason { __NO_PREEMPTION, __ALARM_PREEMPTION, __POLL_PREEMPTION, __MANUAL_PREEMPTION }; 60 enum __Coroutine_State { Halted, Start, Primed, Blocked, Ready, Active }; 96 61 97 62 struct $coroutine { … … 106 71 107 72 // current execution status for coroutine 108 enum coroutine_state state;73 enum __Coroutine_State state; 109 74 110 75 // first coroutine to resume this one … … 161 126 }; 162 127 128 // Link lists fields 129 // instrusive link field for threads 130 struct __thread_desc_link { 131 struct $thread * next; 132 struct $thread * prev; 133 volatile unsigned long long ts; 134 int preferred; 135 }; 136 163 137 struct $thread { 164 138 // Core threading fields … … 167 141 168 142 // current execution status for coroutine 169 volatile int state; 170 enum __Preemption_Reason preempted; 143 volatile int ticket; 144 enum __Coroutine_State state:8; 145 enum __Preemption_Reason preempted:8; 171 146 172 147 //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it 148 149 // pointer to the cluster on which the thread is running 150 struct cluster * curr_cluster; 151 152 // Link lists fields 153 // instrusive link field for threads 154 struct __thread_desc_link link; 173 155 174 156 // coroutine body used to store context … … 184 166 struct $monitor * self_mon_p; 185 167 186 // pointer to the cluster on which the thread is running187 struct cluster * curr_cluster;188 189 168 // monitors currently held by this thread 190 169 struct __monitor_group_t monitors; 191 192 // Link lists fields193 // instrusive link field for threads194 struct $thread * next;195 170 196 171 struct { … … 202 177 // previous function to park/unpark the thread 203 178 const char * park_caller; 204 enum coroutine_state park_result; 179 int park_result; 180 enum __Coroutine_State park_state; 205 181 bool park_stale; 206 182 const char * unpark_caller; 207 enum coroutine_state unpark_result; 183 int unpark_result; 184 enum __Coroutine_State unpark_state; 208 185 bool unpark_stale; 209 186 #endif … … 218 195 #ifdef __cforall 219 196 extern "Cforall" { 197 220 198 static inline $thread *& get_next( $thread & this ) __attribute__((const)) { 221 return this. next;199 return this.link.next; 222 200 } 223 201
Note:
See TracChangeset
for help on using the changeset viewer.