Changeset a633f6f


Ignore:
Timestamp:
Nov 19, 2021, 11:39:35 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
1757f98, c60e5094
Parents:
b14ec5f
Message:

Fix the new FD change.

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.cfa

    rb14ec5f ra633f6f  
    825825                insert_last(this.actives, proc);
    826826
    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
    828833        unlock( this );
    829834        /* paranoid */ verify( ! __preemption_enabled() );
  • libcfa/src/concurrency/kernel_private.hfa

    rb14ec5f ra633f6f  
    268268        ready_schedule_lock();
    269269
    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 );
    280271
    281272        /* paranoid */ verify( ! __preemption_enabled() );
     
    289280        ready_schedule_lock();
    290281
    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 )) {
    298283                // success
    299284                /* paranoid */ verify( ! __preemption_enabled() );
     
    311296        /* paranoid */ verify( ! __preemption_enabled() );
    312297
    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);
    316299
    317300        // Release the global lock, which we acquired when locking
Note: See TracChangeset for help on using the changeset viewer.