Ignore:
Timestamp:
Sep 29, 2021, 6:37:12 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
45c9441
Parents:
197df9b
Message:

Made some of the schedule locking more fine grain.

File:
1 edited

Legend:

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

    r197df9b rc33c2af  
    196196
    197197                        if( !readyThread ) {
     198                                ready_schedule_lock();
    198199                                __cfa_io_flush( this );
     200                                ready_schedule_unlock();
     201
    199202                                readyThread = __next_thread_slow( this->cltr );
    200203                        }
     
    277280
    278281                        if(this->io.pending && !this->io.dirty) {
     282                                ready_schedule_lock();
    279283                                __cfa_io_flush( this );
     284                                ready_schedule_unlock();
    280285                        }
    281286
     
    317322
    318323                                // Don't block if we are done
    319                                 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
     324                                if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) {
     325                                        ready_schedule_unlock();
     326                                        break MAIN_LOOP;
     327                                }
    320328
    321329                                __STATS( __tls_stats()->ready.sleep.halts++; )
     
    939947                        /* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count);
    940948                        /* paranoid */ verify( it->local_data->this_stats );
     949                        // __print_stats( it->local_data->this_stats, cltr->print_stats, "Processor", it->name, (void*)it );
    941950                        __tally_stats( cltr->stats, it->local_data->this_stats );
    942951                        it = &(*it)`next;
     
    948957                // this doesn't solve all problems but does solve many
    949958                // so it's probably good enough
     959                disable_interrupts();
    950960                uint_fast32_t last_size = ready_mutate_lock();
    951961
     
    955965                // Unlock the RWlock
    956966                ready_mutate_unlock( last_size );
     967                enable_interrupts();
    957968        }
    958969
Note: See TracChangeset for help on using the changeset viewer.