Changeset f265042 for src/libcfa/concurrency/invoke.h
- Timestamp:
- Sep 25, 2017, 12:07:43 PM (8 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:
- 3aeaecd
- Parents:
- 1755226 (diff), 596bc0a (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
-
src/libcfa/concurrency/invoke.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/invoke.h
r1755226 rf265042 84 84 }; 85 85 86 struct __waitfor_mask_t { 87 short * accepted; // the index of the accepted function, -1 if none 88 struct __acceptable_t * clauses; // list of acceptable functions, null if any 89 short size; // number of acceptable functions 90 }; 91 86 92 struct monitor_desc { 87 93 struct spinlock lock; // spinlock to protect internal data … … 90 96 struct __condition_stack_t signal_stack; // stack of conditions to run next once we exit the monitor 91 97 unsigned int recursion; // monitor routines can be called recursively, we need to keep track of that 98 struct __waitfor_mask_t mask; // mask used to know if some thread is waiting for something while holding the monitor 99 }; 92 100 93 struct __acceptable_t * acceptables; // list of acceptable functions, null if any 94 unsigned short acceptable_count; // number of acceptable functions 95 short accepted_index; // the index of the accepted function, -1 if none 96 }; 101 struct __monitor_group_t { 102 struct monitor_desc ** list; // currently held monitors 103 short size; // number of currently held monitors 104 fptr_t func; // last function that acquired monitors 105 }; 97 106 98 107 struct thread_desc { 99 108 // Core threading fields 100 struct coroutine_desc cor; // coroutine body used to store context 101 struct monitor_desc mon; // monitor body used for mutual exclusion 109 struct coroutine_desc self_cor; // coroutine body used to store context 110 struct monitor_desc self_mon; // monitor body used for mutual exclusion 111 struct monitor_desc * self_mon_p; // pointer to monitor with sufficient lifetime for current monitors 112 struct __monitor_group_t monitors; // monitors currently held by this thread 102 113 103 114 // Link lists fields 104 115 struct thread_desc * next; // instrusive link field for threads 105 116 106 // Current status related to monitors 107 struct monitor_desc ** current_monitors; // currently held monitors 108 unsigned short current_monitor_count; // number of currently held monitors 109 fptr_t current_monitor_func; // last function that acquired monitors 117 110 118 }; 119 120 #ifdef __CFORALL__ 121 extern "Cforall" { 122 static inline monitor_desc * ?[?]( const __monitor_group_t & this, ptrdiff_t index ) { 123 return this.list[index]; 124 } 125 126 static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) { 127 if( (lhs.list != 0) != (rhs.list != 0) ) return false; 128 if( lhs.size != rhs.size ) return false; 129 if( lhs.func != rhs.func ) return false; 130 131 // Check that all the monitors match 132 for( int i = 0; i < lhs.size; i++ ) { 133 // If not a match, check next function 134 if( lhs[i] != rhs[i] ) return false; 135 } 136 137 return true; 138 } 139 } 140 #endif 111 141 112 142 #endif //_INVOKE_H_
Note:
See TracChangeset
for help on using the changeset viewer.