Changeset 6a490b2 for libcfa/src/concurrency/mutex.cfa
- Timestamp:
- May 11, 2020, 1:53:29 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:
- 504a7dc
- Parents:
- b7d6a36 (diff), a7b486b (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
-
libcfa/src/concurrency/mutex.cfa
rb7d6a36 r6a490b2 40 40 if( is_locked ) { 41 41 append( blocked_threads, kernelTLS.this_thread ); 42 BlockInternal( &lock ); 42 unlock( lock ); 43 park( __cfaabi_dbg_ctx ); 43 44 } 44 45 else { … … 62 63 lock( this.lock __cfaabi_dbg_ctx2 ); 63 64 this.is_locked = (this.blocked_threads != 0); 64 WakeThread(65 pop_head( this.blocked_threads ) 65 unpark( 66 pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2 66 67 ); 67 68 unlock( this.lock ); … … 94 95 else { 95 96 append( blocked_threads, kernelTLS.this_thread ); 96 BlockInternal( &lock ); 97 unlock( lock ); 98 park( __cfaabi_dbg_ctx ); 97 99 } 98 100 } … … 118 120 recursion_count--; 119 121 if( recursion_count == 0 ) { 120 thread_desc* thrd = pop_head( blocked_threads );122 $thread * thrd = pop_head( blocked_threads ); 121 123 owner = thrd; 122 124 recursion_count = (thrd ? 1 : 0); 123 WakeThread( thrd);125 unpark( thrd __cfaabi_dbg_ctx2 ); 124 126 } 125 127 unlock( lock ); … … 138 140 void notify_one(condition_variable & this) with(this) { 139 141 lock( lock __cfaabi_dbg_ctx2 ); 140 WakeThread(141 pop_head( this.blocked_threads ) 142 unpark( 143 pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2 142 144 ); 143 145 unlock( lock ); … … 147 149 lock( lock __cfaabi_dbg_ctx2 ); 148 150 while(this.blocked_threads) { 149 WakeThread(150 pop_head( this.blocked_threads ) 151 unpark( 152 pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2 151 153 ); 152 154 } … … 157 159 lock( this.lock __cfaabi_dbg_ctx2 ); 158 160 append( this.blocked_threads, kernelTLS.this_thread ); 159 BlockInternal( &this.lock ); 161 unlock( this.lock ); 162 park( __cfaabi_dbg_ctx ); 160 163 } 161 164 … … 164 167 lock( this.lock __cfaabi_dbg_ctx2 ); 165 168 append( this.blocked_threads, kernelTLS.this_thread ); 166 void __unlock(void) { 167 unlock(l); 168 unlock(this.lock); 169 } 170 BlockInternal( __unlock ); 169 unlock(l); 170 unlock(this.lock); 171 park( __cfaabi_dbg_ctx ); 171 172 lock(l); 172 173 }
Note:
See TracChangeset
for help on using the changeset viewer.