Ignore:
Timestamp:
Jan 19, 2022, 2:36:56 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
97c215f
Parents:
5235d49 (diff), 6a33e40 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r5235d49 r12c1eef  
    142142extern void __disable_interrupts_hard();
    143143extern void __enable_interrupts_hard();
    144 
    145 static inline void __disable_interrupts_checked() {
    146         /* paranoid */ verify( __preemption_enabled() );
    147         disable_interrupts();
    148         /* paranoid */ verify( ! __preemption_enabled() );
    149 }
    150 
    151 static inline void __enable_interrupts_checked( bool poll = true ) {
    152         /* paranoid */ verify( ! __preemption_enabled() );
    153         enable_interrupts( poll );
    154         /* paranoid */ verify( __preemption_enabled() );
    155 }
    156144
    157145
     
    566554        /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary );
    567555
    568         const bool local = thrd->state != Start;
    569556        if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready;
    570557
     
    749736
    750737        // Check if there is a sleeping processor
    751         int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
     738        // int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
     739        int fd = 0;
     740        if( __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST) != 0 ) {
     741                fd = __atomic_exchange_n(&this->procs.fd, 0, __ATOMIC_RELAXED);
     742        }
    752743
    753744        // If no one is sleeping, we are done
     
    776767// Unconditionnaly wake a thread
    777768void __wake_proc(processor * this) {
     769        /* paranoid */ verify( ! __preemption_enabled() );
     770
    778771        __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this);
    779772
    780         __disable_interrupts_checked();
    781                 /* paranoid */ verify( ! __preemption_enabled() );
    782                 eventfd_t val;
    783                 val = 1;
    784                 eventfd_write( this->idle_fd, val );
    785         __enable_interrupts_checked();
     773        eventfd_t val;
     774        val = 1;
     775        eventfd_write( this->idle_fd, val );
     776
     777        /* paranoid */ verify( ! __preemption_enabled() );
    786778}
    787779
Note: See TracChangeset for help on using the changeset viewer.