Changeset a633f6f
- Timestamp:
- Nov 19, 2021, 11:39:35 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 1757f98, c60e5094
- Parents:
- b14ec5f
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
rb14ec5f ra633f6f 825 825 insert_last(this.actives, proc); 826 826 827 __atomic_store_n(&this.fd, this.idles`first.idle, __ATOMIC_SEQ_CST); 827 { 828 int fd = 0; 829 if(!this.idles`isEmpty) fd = this.idles`first.idle; 830 __atomic_store_n(&this.fd, fd, __ATOMIC_SEQ_CST); 831 } 832 828 833 unlock( this ); 829 834 /* paranoid */ verify( ! __preemption_enabled() ); -
libcfa/src/concurrency/kernel_private.hfa
rb14ec5f ra633f6f 268 268 ready_schedule_lock(); 269 269 270 // Simple counting lock, acquired, acquired by incrementing the counter 271 // to an odd number 272 for() { 273 uint64_t l = this.lock; 274 if( 275 (0 == (l % 2)) 276 && __atomic_compare_exchange_n(&this.lock, &l, l + 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) 277 ) return; 278 Pause(); 279 } 270 lock( this.lock __cfaabi_dbg_ctx2 ); 280 271 281 272 /* paranoid */ verify( ! __preemption_enabled() ); … … 289 280 ready_schedule_lock(); 290 281 291 // Simple counting lock, acquired, acquired by incrementing the counter 292 // to an odd number 293 uint64_t l = this.lock; 294 if( 295 (0 == (l % 2)) 296 && __atomic_compare_exchange_n(&this.lock, &l, l + 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) 297 ) { 282 if(try_lock( this.lock __cfaabi_dbg_ctx2 )) { 298 283 // success 299 284 /* paranoid */ verify( ! __preemption_enabled() ); … … 311 296 /* paranoid */ verify( ! __preemption_enabled() ); 312 297 313 /* paranoid */ verify( 1 == (this.lock % 2) ); 314 // Simple couting lock, release by incrementing to an even number 315 __atomic_fetch_add( &this.lock, 1, __ATOMIC_SEQ_CST ); 298 unlock(this.lock); 316 299 317 300 // Release the global lock, which we acquired when locking
Note: See TracChangeset
for help on using the changeset viewer.