Changeset c76bd34 for libcfa/src/bits/locks.hfa
- Timestamp:
- Oct 7, 2020, 4:31:43 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 848439f
- Parents:
- ae2c27a (diff), 597c5d18 (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/bits/locks.hfa
rae2c27a rc76bd34 164 164 165 165 struct $thread; 166 extern void park( __cfaabi_dbg_ctx_param);167 extern void unpark( struct $thread * this __cfaabi_dbg_ctx_param2);166 extern void park( void ); 167 extern void unpark( struct $thread * this ); 168 168 static inline struct $thread * active_thread (); 169 169 … … 191 191 /* paranoid */ verify( expected == 0p ); 192 192 if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 193 park( __cfaabi_dbg_ctx);193 park(); 194 194 return true; 195 195 } … … 210 210 else { 211 211 if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 212 unpark( expected __cfaabi_dbg_ctx2);212 unpark( expected ); 213 213 return true; 214 214 } … … 244 244 /* paranoid */ verify( expected == 0p ); 245 245 if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 246 park( __cfaabi_dbg_ctx);246 park(); 247 247 /* paranoid */ verify( this.ptr == 1p ); 248 248 return true; … … 256 256 struct $thread * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST); 257 257 if( got == 0p ) return false; 258 unpark( got __cfaabi_dbg_ctx2);258 unpark( got ); 259 259 return true; 260 260 } … … 357 357 struct oneshot * expected = this.ptr; 358 358 // was this abandoned? 359 if( expected == 3p ) { free( &this ); return false; } 359 #if defined(__GNUC__) && __GNUC__ >= 7 360 #pragma GCC diagnostic push 361 #pragma GCC diagnostic ignored "-Wfree-nonheap-object" 362 #endif 363 if( expected == 3p ) { free( &this ); return false; } 364 #if defined(__GNUC__) && __GNUC__ >= 7 365 #pragma GCC diagnostic pop 366 #endif 360 367 361 368 /* paranoid */ verify( expected != 1p ); // Future is already fulfilled, should not happen
Note:
See TracChangeset
for help on using the changeset viewer.