Changeset 6c2ba38 for src/libcfa/concurrency/invoke.h
- Timestamp:
- Nov 28, 2017, 3:52:06 PM (6 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:
- 383e159, 8d5b9cf
- Parents:
- cf966b5 (diff), 8a0a64d9 (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
rcf966b5 r6c2ba38 14 14 // 15 15 16 #include "bits/containers.h" 16 17 #include "bits/defs.h" 17 18 #include "bits/locks.h" 18 19 19 #ifdef __ CFORALL__20 #ifdef __cforall 20 21 extern "C" { 21 22 #endif … … 25 26 #define _INVOKE_H_ 26 27 27 typedef void (*fptr_t)(); 28 typedef int_fast16_t __lock_size_t; 29 30 struct __thread_queue_t { 31 struct thread_desc * head; 32 struct thread_desc ** tail; 33 }; 34 35 struct __condition_stack_t { 36 struct __condition_criterion_t * top; 37 }; 38 39 #ifdef __CFORALL__ 28 #ifdef __cforall 40 29 extern "Cforall" { 41 void ?{}( struct __thread_queue_t & ); 42 void append( struct __thread_queue_t &, struct thread_desc * ); 43 struct thread_desc * pop_head( struct __thread_queue_t & ); 44 struct thread_desc * remove( struct __thread_queue_t &, struct thread_desc ** ); 45 46 void ?{}( struct __condition_stack_t & ); 47 void push( struct __condition_stack_t &, struct __condition_criterion_t * ); 48 struct __condition_criterion_t * pop( struct __condition_stack_t & ); 30 static inline struct thread_desc * & get_next( struct thread_desc & this ); 31 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this ); 49 32 } 50 33 #endif … … 100 83 101 84 // list of acceptable functions, null if any 102 struct __acceptable_t * clauses; 103 104 // number of acceptable functions 105 __lock_size_t size; 85 __small_array_t(struct __acceptable_t) __cfa_anonymous_object; 106 86 }; 107 87 … … 114 94 115 95 // queue of threads that are blocked waiting for the monitor 116 struct __thread_queue_tentry_queue;96 __queue_t(struct thread_desc) entry_queue; 117 97 118 98 // stack of conditions to run next once we exit the monitor 119 struct __condition_stack_tsignal_stack;99 __stack_t(struct __condition_criterion_t) signal_stack; 120 100 121 101 // monitor routines can be called recursively, we need to keep track of that … … 131 111 struct __monitor_group_t { 132 112 // currently held monitors 133 struct monitor_desc ** list; 134 135 // number of currently held monitors 136 __lock_size_t size; 113 __small_array_t(monitor_desc*) __cfa_anonymous_object; 137 114 138 115 // last function that acquired monitors … … 159 136 }; 160 137 161 #ifdef __ CFORALL__138 #ifdef __cforall 162 139 extern "Cforall" { 163 static inline monitor_desc * ?[?]( const __monitor_group_t & this, ptrdiff_t index ) { 164 return this.list[index]; 140 static inline thread_desc * & get_next( thread_desc & this ) { 141 return this.next; 142 } 143 144 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this ); 145 146 static inline void ?{}(__monitor_group_t & this) { 147 (this.data){NULL}; 148 (this.size){0}; 149 (this.func){NULL}; 150 } 151 152 static inline void ?{}(__monitor_group_t & this, struct monitor_desc ** data, __lock_size_t size, fptr_t func) { 153 (this.data){data}; 154 (this.size){size}; 155 (this.func){func}; 165 156 } 166 157 167 158 static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) { 168 if( (lhs. list != 0) != (rhs.list!= 0) ) return false;159 if( (lhs.data != 0) != (rhs.data != 0) ) return false; 169 160 if( lhs.size != rhs.size ) return false; 170 161 if( lhs.func != rhs.func ) return false; … … 177 168 178 169 return true; 170 } 171 172 static inline void ?=?(__monitor_group_t & lhs, const __monitor_group_t & rhs) { 173 lhs.data = rhs.data; 174 lhs.size = rhs.size; 175 lhs.func = rhs.func; 179 176 } 180 177 } … … 210 207 #endif //_INVOKE_PRIVATE_H_ 211 208 #endif //! defined(__CFA_INVOKE_PRIVATE__) 212 #ifdef __ CFORALL__209 #ifdef __cforall 213 210 } 214 211 #endif
Note: See TracChangeset
for help on using the changeset viewer.