Changes in libcfa/src/concurrency/invoke.h [24e321c:1f45c7d]
- File:
-
- 1 edited
-
libcfa/src/concurrency/invoke.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/invoke.h
r24e321c r1f45c7d 71 71 enum __Coroutine_State { Halted, Start, Primed, Blocked, Ready, Active, Cancelled, Halting }; 72 72 73 struct coroutine${73 struct $coroutine { 74 74 // context that is switch during a __cfactx_switch 75 75 struct __stack_context_t context; … … 85 85 86 86 // first coroutine to resume this one 87 struct coroutine$* starter;87 struct $coroutine * starter; 88 88 89 89 // last coroutine to resume this one 90 struct coroutine$* last;90 struct $coroutine * last; 91 91 92 92 // If non-null stack must be unwound with this exception … … 95 95 }; 96 96 // Wrapper for gdb 97 struct cfathread_coroutine_t { struct coroutine$debug; };98 99 static inline struct __stack_t * __get_stack( struct coroutine$* cor ) {97 struct cfathread_coroutine_t { struct $coroutine debug; }; 98 99 static inline struct __stack_t * __get_stack( struct $coroutine * cor ) { 100 100 return (struct __stack_t*)(((uintptr_t)cor->stack.storage) & ((uintptr_t)-2)); 101 101 } … … 110 110 }; 111 111 112 struct monitor${112 struct $monitor { 113 113 // spinlock to protect internal data 114 114 struct __spinlock_t lock; 115 115 116 116 // current owner of the monitor 117 struct thread$* owner;117 struct $thread * owner; 118 118 119 119 // queue of threads that are blocked waiting for the monitor 120 __queue_t(struct thread$) entry_queue;120 __queue_t(struct $thread) entry_queue; 121 121 122 122 // stack of conditions to run next once we exit the monitor … … 133 133 }; 134 134 // Wrapper for gdb 135 struct cfathread_monitor_t { struct monitor$debug; };135 struct cfathread_monitor_t { struct $monitor debug; }; 136 136 137 137 struct __monitor_group_t { 138 138 // currently held monitors 139 __cfa_anonymous_object( __small_array_t( monitor$*) );139 __cfa_anonymous_object( __small_array_t($monitor*) ); 140 140 141 141 // last function that acquired monitors … … 146 146 // instrusive link field for threads 147 147 struct __thread_desc_link { 148 struct thread$* next;148 struct $thread * next; 149 149 volatile unsigned long long ts; 150 150 }; 151 151 152 struct thread${152 struct $thread { 153 153 // Core threading fields 154 154 // context that is switch during a __cfactx_switch … … 170 170 bool corctx_flag; 171 171 172 int last_cpu; 173 172 174 //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it 173 175 … … 175 177 struct cluster * curr_cluster; 176 178 177 // preferred ready-queue or CPU179 // preferred ready-queue 178 180 unsigned preferred; 179 181 180 182 // coroutine body used to store context 181 struct coroutine$self_cor;183 struct $coroutine self_cor; 182 184 183 185 // current active context 184 struct coroutine$* curr_cor;186 struct $coroutine * curr_cor; 185 187 186 188 // monitor body used for mutual exclusion 187 struct monitor$self_mon;189 struct $monitor self_mon; 188 190 189 191 // pointer to monitor with sufficient lifetime for current monitors 190 struct monitor$* self_mon_p;192 struct $monitor * self_mon_p; 191 193 192 194 // monitors currently held by this thread … … 195 197 // used to put threads on user data structures 196 198 struct { 197 struct thread$* next;198 struct thread$* back;199 struct $thread * next; 200 struct $thread * back; 199 201 } seqable; 200 202 201 203 // used to put threads on dlist data structure 202 __cfa_dlink( thread$);204 __cfa_dlink($thread); 203 205 204 206 struct { 205 struct thread$* next;206 struct thread$* prev;207 struct $thread * next; 208 struct $thread * prev; 207 209 } node; 208 210 … … 214 216 }; 215 217 #ifdef __cforall 216 P9_EMBEDDED( thread$, dlink(thread$) )218 P9_EMBEDDED( $thread, dlink($thread) ) 217 219 #endif 218 220 // Wrapper for gdb 219 struct cfathread_thread_t { struct thread$debug; };221 struct cfathread_thread_t { struct $thread debug; }; 220 222 221 223 #ifdef __CFA_DEBUG__ 222 void __cfaabi_dbg_record_thrd( thread$& this, bool park, const char prev_name[]);224 void __cfaabi_dbg_record_thrd($thread & this, bool park, const char prev_name[]); 223 225 #else 224 226 #define __cfaabi_dbg_record_thrd(x, y, z) … … 228 230 extern "Cforall" { 229 231 230 static inline thread$ *& get_next( thread$& this ) __attribute__((const)) {232 static inline $thread *& get_next( $thread & this ) __attribute__((const)) { 231 233 return this.link.next; 232 234 } 233 235 234 static inline [ thread$ *&, thread$ *& ] __get( thread$& this ) __attribute__((const)) {236 static inline [$thread *&, $thread *& ] __get( $thread & this ) __attribute__((const)) { 235 237 return this.node.[next, prev]; 236 238 } 237 239 238 static inline thread$ * volatile & ?`next ( thread$* this ) __attribute__((const)) {240 static inline $thread * volatile & ?`next ( $thread * this ) __attribute__((const)) { 239 241 return this->seqable.next; 240 242 } 241 243 242 static inline thread$ *& Back( thread$* this ) __attribute__((const)) {244 static inline $thread *& Back( $thread * this ) __attribute__((const)) { 243 245 return this->seqable.back; 244 246 } 245 247 246 static inline thread$ *& Next( thread$* this ) __attribute__((const)) {248 static inline $thread *& Next( $thread * this ) __attribute__((const)) { 247 249 return this->seqable.next; 248 250 } 249 251 250 static inline bool listed( thread$* this ) {252 static inline bool listed( $thread * this ) { 251 253 return this->seqable.next != 0p; 252 254 } … … 258 260 } 259 261 260 static inline void ?{}(__monitor_group_t & this, struct monitor$** data, __lock_size_t size, fptr_t func) {262 static inline void ?{}(__monitor_group_t & this, struct $monitor ** data, __lock_size_t size, fptr_t func) { 261 263 (this.data){data}; 262 264 (this.size){size};
Note:
See TracChangeset
for help on using the changeset viewer.